17#include "moc_qgssingleitemmodel.cpp"
21 : QAbstractItemModel( parent )
30 : QAbstractItemModel( parent )
31 , mColumnData( columnData )
44 if ( !mColumnData.isEmpty() )
46 return mColumnData.value(
index.column() ).value( role );
56 return mData.value( Qt::ToolTipRole, mText );
59 return mData.value( role );
66 if (
index.isValid() )
72 return QAbstractItemModel::flags(
index );
78 if ( !hasIndex( row, column,
parent ) )
83 return createIndex( row, column );
105 if ( !mColumnData.empty() )
106 return mColumnData.size();
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Qt::ItemFlags flags(const QModelIndex &index) const override
int columnCount(const QModelIndex &parent=QModelIndex()) const override
QVariant data(const QModelIndex &index, int role) const override
QModelIndex parent(const QModelIndex &index) const override
QgsSingleItemModel(QObject *parent=nullptr, const QString &text=QString(), const QMap< int, QVariant > &data=QMap< int, QVariant >(), Qt::ItemFlags flags=Qt::NoItemFlags)
Constructor for QgsSingleItemModel with the specified parent object and display text.
int rowCount(const QModelIndex &parent=QModelIndex()) const override