Class: QgsAttributeTableDelegate

A delegate item class for QgsAttributeTable (see Qt documentation for QItemDelegate).

Class Hierarchy

Inheritance diagram of qgis.gui.QgsAttributeTableDelegate

Base classes

QItemDelegate

QAbstractItemDelegate

QObject

Methods

setFeatureSelectionModel

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsAttributeTableDelegate. See the FAQ for more details.

createEditor

Used to create an editor for when the user tries to change the contents of a cell

paint

Overloads the paint method form the QItemDelegate base class

setEditorData

Sets data from model into the editor.

setModelData

Sets data from editor back to model.

Signals

actionColumnItemPainted

Emitted when an action column item is painted.

class qgis.gui.QgsAttributeTableDelegate[source]

Bases: QItemDelegate

__init__(parent: QObject | None = None)

Constructor

Parameters:

parent (Optional[QObject] = None) – parent object

signal actionColumnItemPainted[source]

Emitted when an action column item is painted. The consumer of this signal can initialize the index widget.

Note

This signal is emitted repeatedly whenever the item is being painted. It is the consumers responsibility to check if initialization has already happened before.

virtual createEditor(self, parent: QWidget | None, option: QStyleOptionViewItem, index: QModelIndex) QWidget | None[source]

Used to create an editor for when the user tries to change the contents of a cell

Parameters:
  • parent (Optional[QWidget])

  • option (QStyleOptionViewItem)

  • index (QModelIndex)

Return type:

Optional[QWidget]

virtual paint(self, painter: QPainter | None, option: QStyleOptionViewItem, index: QModelIndex)[source]

Overloads the paint method form the QItemDelegate base class

Parameters:
  • painter (Optional[QPainter])

  • option (QStyleOptionViewItem)

  • index (QModelIndex)

virtual setEditorData(self, editor: QWidget | None, index: QModelIndex)[source]

Sets data from model into the editor. Overloads default method

Parameters:
  • editor (Optional[QWidget]) – editor which was created by create editor function in this class

  • index (QModelIndex) – index of field which is to be retrieved

setFeatureSelectionModel(self, featureSelectionModel: QgsFeatureSelectionModel | None)[source]
Parameters:

featureSelectionModel (Optional[QgsFeatureSelectionModel])

virtual setModelData(self, editor: QWidget | None, model: QAbstractItemModel | None, index: QModelIndex)[source]

Sets data from editor back to model. Overloads default method

Parameters:
  • editor (Optional[QWidget]) – editor which was created by create editor function in this class

  • model (Optional[QAbstractItemModel]) – model where data should be updated

  • index (QModelIndex) – index of field which is to be modified