diff --git a/src/widgets/TypesWidget.cpp b/src/widgets/TypesWidget.cpp index 3891314e..c31a50d6 100644 --- a/src/widgets/TypesWidget.cpp +++ b/src/widgets/TypesWidget.cpp @@ -14,6 +14,17 @@ TypesModel::TypesModel(QList *types, QObject *parent) { } +QVariant TypesModel::toolTipValue(const QModelIndex &index) const +{ + TypeDescription t = index.data(TypesModel::TypeDescriptionRole).value(); + + 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: diff --git a/src/widgets/TypesWidget.h b/src/widgets/TypesWidget.h index dec3ece5..53037790 100644 --- a/src/widgets/TypesWidget.h +++ b/src/widgets/TypesWidget.h @@ -30,6 +30,11 @@ class TypesModel : public QAbstractListModel private: QList *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;