QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
QgsSingleItemModel Class Reference

A QAbstractItemModel subclass which contains a single read-only item. More...

#include <qgssingleitemmodel.h>

Inheritance diagram for QgsSingleItemModel:

Public Member Functions

 QgsSingleItemModel (QObject *parent, const QList< QMap< int, QVariant > > &columnData, Qt::ItemFlags flags=Qt::NoItemFlags)
 Constructor for a multi-column QgsSingleItemModel with the specified parent object.
 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 columnCount (const QModelIndex &parent=QModelIndex()) const override
QVariant data (const QModelIndex &index, int role) const override
Qt::ItemFlags flags (const QModelIndex &index) const override
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
QModelIndex parent (const QModelIndex &index) const override
int rowCount (const QModelIndex &parent=QModelIndex()) const override

Detailed Description

A QAbstractItemModel subclass which contains a single read-only item.

Since
QGIS 3.26

Definition at line 32 of file qgssingleitemmodel.h.

Constructor & Destructor Documentation

◆ QgsSingleItemModel() [1/2]

QgsSingleItemModel::QgsSingleItemModel ( QObject * parent = nullptr,
const QString & text = QString(),
const QMap< int, QVariant > & data = QMap< int, QVariant >(),
Qt::ItemFlags flags = Qt::NoItemFlags )
explicit

Constructor for QgsSingleItemModel with the specified parent object and display text.

The data map specifies the data which should be returned for the specified roles, where map keys are Qt item roles.

Custom flags can also be specified for the item.

Definition at line 20 of file qgssingleitemmodel.cpp.

◆ QgsSingleItemModel() [2/2]

QgsSingleItemModel::QgsSingleItemModel ( QObject * parent,
const QList< QMap< int, QVariant > > & columnData,
Qt::ItemFlags flags = Qt::NoItemFlags )
explicit

Constructor for a multi-column QgsSingleItemModel with the specified parent object.

The columnData list specifies the data which should be returned for the specified roles for each column in the model, where each entry in the list must be a QMap of Qt item role to value.

Custom flags can also be specified for the item.

Definition at line 29 of file qgssingleitemmodel.cpp.

Member Function Documentation

◆ columnCount()

int QgsSingleItemModel::columnCount ( const QModelIndex & parent = QModelIndex()) const
override

Definition at line 103 of file qgssingleitemmodel.cpp.

◆ data()

QVariant QgsSingleItemModel::data ( const QModelIndex & index,
int role ) const
override

Definition at line 36 of file qgssingleitemmodel.cpp.

◆ flags()

Qt::ItemFlags QgsSingleItemModel::flags ( const QModelIndex & index) const
override

Definition at line 64 of file qgssingleitemmodel.cpp.

◆ index()

QModelIndex QgsSingleItemModel::index ( int row,
int column,
const QModelIndex & parent = QModelIndex() ) const
override

Definition at line 76 of file qgssingleitemmodel.cpp.

◆ parent()

QModelIndex QgsSingleItemModel::parent ( const QModelIndex & index) const
override

Definition at line 89 of file qgssingleitemmodel.cpp.

◆ rowCount()

int QgsSingleItemModel::rowCount ( const QModelIndex & parent = QModelIndex()) const
override

Definition at line 94 of file qgssingleitemmodel.cpp.


The documentation for this class was generated from the following files: