mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 19:36:11 +00:00
Show C type definition in tooltip in Types widget (#3169)
This commit is contained in:
parent
68b3cb1004
commit
8c89dfde8b
@ -14,6 +14,17 @@ TypesModel::TypesModel(QList<TypeDescription> *types, QObject *parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariant TypesModel::toolTipValue(const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
TypeDescription t = index.data(TypesModel::TypeDescriptionRole).value<TypeDescription>();
|
||||||
|
|
||||||
|
if (t.category == "Primitive") {
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Core()->getTypeAsC(t.type).trimmed();
|
||||||
|
}
|
||||||
|
|
||||||
int TypesModel::rowCount(const QModelIndex &) const
|
int TypesModel::rowCount(const QModelIndex &) const
|
||||||
{
|
{
|
||||||
return types->count();
|
return types->count();
|
||||||
@ -45,6 +56,8 @@ QVariant TypesModel::data(const QModelIndex &index, int role) const
|
|||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
case Qt::ToolTipRole:
|
||||||
|
return toolTipValue(index);
|
||||||
case TypeDescriptionRole:
|
case TypeDescriptionRole:
|
||||||
return QVariant::fromValue(exp);
|
return QVariant::fromValue(exp);
|
||||||
default:
|
default:
|
||||||
|
@ -30,6 +30,11 @@ class TypesModel : public QAbstractListModel
|
|||||||
private:
|
private:
|
||||||
QList<TypeDescription> *types;
|
QList<TypeDescription> *types;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns a description of the type for the given index
|
||||||
|
*/
|
||||||
|
QVariant toolTipValue(const QModelIndex &index) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Columns { TYPE = 0, SIZE, CATEGORY, FORMAT, COUNT };
|
enum Columns { TYPE = 0, SIZE, CATEGORY, FORMAT, COUNT };
|
||||||
static const int TypeDescriptionRole = Qt::UserRole;
|
static const int TypeDescriptionRole = Qt::UserRole;
|
||||||
|
Loading…
Reference in New Issue
Block a user