mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 19:06:10 +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
|
||||
{
|
||||
return types->count();
|
||||
@ -45,6 +56,8 @@ QVariant TypesModel::data(const QModelIndex &index, int role) const
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
case Qt::ToolTipRole:
|
||||
return toolTipValue(index);
|
||||
case TypeDescriptionRole:
|
||||
return QVariant::fromValue(exp);
|
||||
default:
|
||||
|
@ -30,6 +30,11 @@ class TypesModel : public QAbstractListModel
|
||||
private:
|
||||
QList<TypeDescription> *types;
|
||||
|
||||
/**
|
||||
* @brief Returns a description of the type for the given index
|
||||
*/
|
||||
QVariant toolTipValue(const QModelIndex &index) const;
|
||||
|
||||
public:
|
||||
enum Columns { TYPE = 0, SIZE, CATEGORY, FORMAT, COUNT };
|
||||
static const int TypeDescriptionRole = Qt::UserRole;
|
||||
|
Loading…
Reference in New Issue
Block a user