Skip to content

PythonQt.QtGui.QAbstractItemDelegate · declarations 001

Back to PythonQt.QtGui.QAbstractItemDelegate

EditNextItem instance-attribute

EditNextItem: Any

EditPreviousItem instance-attribute

EditPreviousItem: Any

EndEditHint instance-attribute

EndEditHint: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

NoHint instance-attribute

NoHint: Any

RevertModelCache instance-attribute

RevertModelCache: Any

SubmitModelCache instance-attribute

SubmitModelCache: Any

closeEditor

closeEditor(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QAbstractItemDelegate.closeEditor; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QAbstractItemDelegate::closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint \= NoHint)

This signal is emitted when the user has finished editing an item using the specified editor.

The hint provides a way for the delegate to influence how the model and view behave after editing is completed. It indicates to these components what action should be performed next to provide a comfortable editing experience for the user. For example, if EditNextItem is specified, the view should use a delegate to open an editor on the next item in the model.

See also EndEditHint.

Source: https://doc.qt.io/archives/qt-5.15/qabstractitemdelegate.html#closeEditor

commitData

commitData(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QAbstractItemDelegate.commitData; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QAbstractItemDelegate::commitData(QWidget *editor)

This signal must be emitted when the editor widget has completed editing the data, and wants to write it back into the model.

Source: https://doc.qt.io/archives/qt-5.15/qabstractitemdelegate.html#commitData

createEditor

createEditor(parent: Any, option: Any, index: Any) -> Any

X.createEditor(parent, option, index) -> PythonQt.QtGui.QWidget

Supplemental documentation: Qt 5 reference:

[virtual] QWidget *QAbstractItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem \&option, const QModelIndex \&index) const

Returns the editor to be used for editing the data item with the given index. Note that the index contains information about the model being used. The editor's parent widget is specified by parent, and the item options by option.

The base implementation returns nullptr. If you want custom editing you will need to reimplement this function.

The returned editor widget should have Qt::StrongFocus; otherwise, QMouseEvents received by the widget will propagate to the view. The view's background will shine through unless the editor paints its own background (e.g., with setAutoFillBackground()).

See also destroyEditor(), setModelData(), and setEditorData().

Upstream PySide2 reference signatures (binding differences may apply):

createEditor(self, parent: PySide2.QtWidgets.QWidget, option: PySide2.QtWidgets.QStyleOptionViewItem, index: PySide2.QtCore.QModelIndex) -> PySide2.QtWidgets.QWidget

Source: https://doc.qt.io/archives/qt-5.15/qabstractitemdelegate.html#createEditor

destroyEditor

destroyEditor(editor: Any, index: Any) -> None

X.destroyEditor(editor, index)

Supplemental documentation: Qt 5 reference:

[virtual] void QAbstractItemDelegate::destroyEditor(QWidget *editor, const QModelIndex \&index) const

Called when the editor is no longer needed for editing the data item with the given index and should be destroyed. The default behavior is a call to deleteLater on the editor. It is possible e.g. to avoid this delete by reimplementing this function.

This function was introduced in Qt 5.0.

See also createEditor().

Upstream PySide2 reference signatures (binding differences may apply):

destroyEditor(self, editor: PySide2.QtWidgets.QWidget, index: PySide2.QtCore.QModelIndex) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractitemdelegate.html#destroyEditor

destroyed

destroyed(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QAbstractItemDelegate.destroyed; argument details are not documented.

editorEvent

editorEvent(event: Any, model: Any, option: Any, index: Any) -> bool

X.editorEvent(event, model, option, index) -> bool

Supplemental documentation: Qt 5 reference:

[virtual] bool QAbstractItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem \&option, const QModelIndex \&index)

When editing of an item starts, this function is called with the event that triggered the editing, the model, the index of the item, and the option used for rendering the item.

Mouse events are sent to editorEvent() even if they don't start editing of the item. This can, for instance, be useful if you wish to open a context menu when the right mouse button is pressed on an item.

The base implementation returns false (indicating that it has not handled the event).

Upstream PySide2 reference signatures (binding differences may apply):

editorEvent(self, event: PySide2.QtCore.QEvent, model: PySide2.QtCore.QAbstractItemModel, option: PySide2.QtWidgets.QStyleOptionViewItem, index: PySide2.QtCore.QModelIndex) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qabstractitemdelegate.html#editorEvent

helpEvent

helpEvent(event: Any, view: Any, option: Any, index: Any) -> bool

X.helpEvent(event, view, option, index) -> bool

Supplemental documentation: Qt 5 reference:

[virtual] bool QAbstractItemDelegate::helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem \&option, const QModelIndex \&index)

Whenever a help event occurs, this function is called with the event view option and the index that corresponds to the item where the event occurs.

Returns true if the delegate can handle the event; otherwise returns false. A return value of true indicates that the data obtained using the index had the required role.

For QEvent::ToolTip and QEvent::WhatsThis events that were handled successfully, the relevant popup may be shown depending on the user's system configuration.

This function was introduced in Qt 4.3.

See also QHelpEvent.

Upstream PySide2 reference signatures (binding differences may apply):

helpEvent(self, event: PySide2.QtGui.QHelpEvent, view: PySide2.QtWidgets.QAbstractItemView, option: PySide2.QtWidgets.QStyleOptionViewItem, index: PySide2.QtCore.QModelIndex) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qabstractitemdelegate.html#helpEvent

objectNameChanged

objectNameChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QAbstractItemDelegate.objectNameChanged; argument details are not documented.

paint

paint(painter: Any, option: Any, index: Any) -> None

X.paint(painter, option, index)

Supplemental documentation: Qt 5 reference:

[pure virtual] void QAbstractItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem \&option, const QModelIndex \&index) const

This pure abstract function must be reimplemented if you want to provide custom rendering. Use the painter and style option to render the item specified by the item index.

If you reimplement this you must also reimplement sizeHint().

Upstream PySide2 reference signatures (binding differences may apply):

paint(self, painter: PySide2.QtGui.QPainter, option: PySide2.QtWidgets.QStyleOptionViewItem, index: PySide2.QtCore.QModelIndex) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractitemdelegate.html#paint

paintingRoles

paintingRoles() -> tuple

X.paintingRoles() -> tuple

Upstream PySide2 reference signatures (binding differences may apply):

paintingRoles(self) -> typing.List[int]

Source: https://doc.qt.io/archives/qt-5.15/qabstractitemdelegate.html#paintingRoles

setEditorData

setEditorData(editor: Any, index: Any) -> None

X.setEditorData(editor, index)

Supplemental documentation: Qt 5 reference:

[virtual] void QAbstractItemDelegate::setEditorData(QWidget *editor, const QModelIndex \&index) const

Sets the contents of the given editor to the data for the item at the given index. Note that the index contains information about the model being used.

The base implementation does nothing. If you want custom editing you will need to reimplement this function.

See also setModelData().

Upstream PySide2 reference signatures (binding differences may apply):

setEditorData(self, editor: PySide2.QtWidgets.QWidget, index: PySide2.QtCore.QModelIndex) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractitemdelegate.html#setEditorData

setModelData

setModelData(editor: Any, model: Any, index: Any) -> None

X.setModelData(editor, model, index)

Supplemental documentation: Qt 5 reference:

[virtual] void QAbstractItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex \&index) const

Sets the data for the item at the given index in the model to the contents of the given editor.

The base implementation does nothing. If you want custom editing you will need to reimplement this function.

See also setEditorData().

Upstream PySide2 reference signatures (binding differences may apply):

setModelData(self, editor: PySide2.QtWidgets.QWidget, model: PySide2.QtCore.QAbstractItemModel, index: PySide2.QtCore.QModelIndex) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractitemdelegate.html#setModelData

sizeHint

sizeHint(option: Any, index: Any) -> Any

X.sizeHint(option, index) -> PythonQt.QtCore.QSize

Supplemental documentation: Qt 5 reference:

[pure virtual] QSize QAbstractItemDelegate::sizeHint(const QStyleOptionViewItem \&option, const QModelIndex \&index) const

This pure abstract function must be reimplemented if you want to provide custom rendering. The options are specified by option and the model item by index.

If you reimplement this you must also reimplement paint().

Upstream PySide2 reference signatures (binding differences may apply):

sizeHint(self, option: PySide2.QtWidgets.QStyleOptionViewItem, index: PySide2.QtCore.QModelIndex) -> PySide2.QtCore.QSize

Source: https://doc.qt.io/archives/qt-5.15/qabstractitemdelegate.html#sizeHint

sizeHintChanged

sizeHintChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QAbstractItemDelegate.sizeHintChanged; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QAbstractItemDelegate::sizeHintChanged(const QModelIndex \&index)

This signal must be emitted when the sizeHint() of index changed.

Views automatically connect to this signal and relayout items as necessary.

This function was introduced in Qt 4.4.

Source: https://doc.qt.io/archives/qt-5.15/qabstractitemdelegate.html#sizeHintChanged

updateEditorGeometry

updateEditorGeometry(editor: Any, option: Any, index: Any) -> None

X.updateEditorGeometry(editor, option, index)

Supplemental documentation: Qt 5 reference:

[virtual] void QAbstractItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem \&option, const QModelIndex \&index) const

Updates the geometry of the editor for the item with the given index, according to the rectangle specified in the option. If the item has an internal layout, the editor will be laid out accordingly. Note that the index contains information about the model being used.

The base implementation does nothing. If you want custom editing you must reimplement this function.

Upstream PySide2 reference signatures (binding differences may apply):

updateEditorGeometry(self, editor: PySide2.QtWidgets.QWidget, option: PySide2.QtWidgets.QStyleOptionViewItem, index: PySide2.QtCore.QModelIndex) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractitemdelegate.html#updateEditorGeometry