Class: QgsSingleItemModel

class qgis.core.QgsSingleItemModel

Bases: PyQt5.QtCore.QAbstractItemModel

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

New in version 3.26.

QgsSingleItemModel(parent: QObject = None, text: str = ‘’, data: Dict[int, Any] = {}, flags: Union[Qt.ItemFlags, Qt.ItemFlag] = Qt.NoItemFlags) 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.

QgsSingleItemModel(parent: QObject, columnData: object, flags: Union[Qt.ItemFlags, Qt.ItemFlag] = Qt.NoItemFlags) 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.

beginInsertColumns(self, QModelIndex, int, int)
beginInsertRows(self, QModelIndex, int, int)
beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) bool
beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) bool
beginRemoveColumns(self, QModelIndex, int, int)
beginRemoveRows(self, QModelIndex, int, int)
beginResetModel(self)
changePersistentIndex(self, QModelIndex, QModelIndex)
changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])
childEvent(self, QChildEvent)
columnCount(self, parent: QModelIndex = QModelIndex()) int
Parameters:

parent (QModelIndex = QModelIndex()) –

Return type:

int

connectNotify(self, QMetaMethod)
createIndex(self, int, int, object: object = 0) QModelIndex
customEvent(self, QEvent)
data(self, index: QModelIndex, role: int) Any
Parameters:
  • index (QModelIndex) –

  • role (int) –

Return type:

Any

decodeData(self, int, int, QModelIndex, QDataStream) bool
disconnectNotify(self, QMetaMethod)
encodeData(self, Iterable[QModelIndex], QDataStream)
endInsertColumns(self)
endInsertRows(self)
endMoveColumns(self)
endMoveRows(self)
endRemoveColumns(self)
endRemoveRows(self)
endResetModel(self)
flags(self, index: QModelIndex) Qt.ItemFlags
Parameters:

index (QModelIndex) –

Return type:

Qt.ItemFlags

index(self, row: int, column: int, parent: QModelIndex = QModelIndex()) QModelIndex
Parameters:
  • row (int) –

  • column (int) –

  • parent (QModelIndex = QModelIndex()) –

Return type:

QModelIndex

isSignalConnected(self, QMetaMethod) bool
parent(self, index: QModelIndex) QModelIndex
Parameters:

index (QModelIndex) –

Return type:

QModelIndex

persistentIndexList(self) List[QModelIndex]
receivers(self, PYQT_SIGNAL) int
resetInternalData(self)
rowCount(self, parent: QModelIndex = QModelIndex()) int
Parameters:

parent (QModelIndex = QModelIndex()) –

Return type:

int

sender(self) QObject
senderSignalIndex(self) int
timerEvent(self, QTimerEvent)