QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | List of all members
QgsSingleItemModel Class Reference

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

#include <qgssingleitemmodel.h>

Inheritance diagram for QgsSingleItemModel:
Inheritance graph
[legend]

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. More...
 
 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. More...
 
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 QgsSingleItemModel subclass which contains a single read-only item.

Since
QGIS 3.26

Definition at line 31 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 19 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 28 of file qgssingleitemmodel.cpp.

Member Function Documentation

◆ columnCount()

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

Definition at line 102 of file qgssingleitemmodel.cpp.

◆ data()

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

Definition at line 35 of file qgssingleitemmodel.cpp.

◆ flags()

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

Definition at line 63 of file qgssingleitemmodel.cpp.

◆ index()

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

Definition at line 75 of file qgssingleitemmodel.cpp.

◆ parent()

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

Definition at line 88 of file qgssingleitemmodel.cpp.

◆ rowCount()

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

Definition at line 93 of file qgssingleitemmodel.cpp.


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