Skip to content

PythonQt.QtGui.QStyledItemDelegate · declarations 001

Back to PythonQt.QtGui.QStyledItemDelegate

closeEditor

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

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

commitData

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

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

createEditor

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

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

Supplemental documentation: Qt 5 reference:

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

Reimplements: QAbstractItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem \&option, const QModelIndex \&index) const.

Returns the widget used to edit the item specified by index for editing. The parent widget and style option are used to control how the editor widget appears.

See also QAbstractItemDelegate::createEditor().

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/qstyleditemdelegate.html#createEditor

destroyed

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

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

displayText

displayText(value: Any, locale: Any) -> str

X.displayText(value, locale) -> str

Supplemental documentation: Qt 5 reference:

[virtual] QString QStyledItemDelegate::displayText(const QVariant \&value, const QLocale \&locale) const

This function returns the string that the delegate will use to display the Qt::DisplayRole of the model in locale. value is the value of the Qt::DisplayRole provided by the model.

The default implementation uses the QLocale::toString to convert value into a QString.

This function is not called for empty model indices, i.e., indices for which the model returns an invalid QVariant.

See also QAbstractItemModel::data().

Upstream PySide2 reference signatures (binding differences may apply):

displayText(self, value: typing.Any, locale: PySide2.QtCore.QLocale) -> str

Source: https://doc.qt.io/archives/qt-5.15/qstyleditemdelegate.html#displayText

editorEvent

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

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

Supplemental documentation: Qt 5 reference:

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

Reimplements: QAbstractItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem \&option, const QModelIndex \&index).

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/qstyleditemdelegate.html#editorEvent

eventFilter

eventFilter(object: Any, event: Any) -> bool

X.eventFilter(object, event) -> bool

Supplemental documentation: Qt 5 reference:

[override virtual protected] bool QStyledItemDelegate::eventFilter(QObject *editor, QEvent *event)

Reimplements: QObject::eventFilter(QObject *watched, QEvent *event).

Returns true if the given editor is a valid QWidget and the given event is handled; otherwise returns false. The following key press events are handled by default:

  • Tab
  • Backtab
  • Enter
  • Return
  • Esc

If the editor's type is QTextEdit or QPlainTextEdit then Enter and Return keys are not handled.

In the case of Tab, Backtab, Enter and Return key press events, the editor's data is committed to the model and the editor is closed. If the event is a Tab key press the view will open an editor on the next item in the view. Likewise, if the event is a Backtab key press the view will open an editor on the previous item in the view.

If the event is a Esc key press event, the editor is closed without committing its data.

See also commitData() and closeEditor().

Upstream PySide2 reference signatures (binding differences may apply):

eventFilter(self, object: PySide2.QtCore.QObject, event: PySide2.QtCore.QEvent) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qstyleditemdelegate.html#eventFilter

initStyleOption

initStyleOption(option: Any, index: Any) -> None

X.initStyleOption(option, index)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QStyledItemDelegate::initStyleOption(QStyleOptionViewItem *option, const QModelIndex \&index) const

Initialize option with the values using the index index. This method is useful for subclasses when they need a QStyleOptionViewItem, but don't want to fill in all the information themselves.

See also QStyleOption::initFrom().

Upstream PySide2 reference signatures (binding differences may apply):

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

Source: https://doc.qt.io/archives/qt-5.15/qstyleditemdelegate.html#initStyleOption

itemEditorFactory

itemEditorFactory() -> Any

X.itemEditorFactory() -> PythonQt.QtGui.QItemEditorFactory

Supplemental documentation: Qt 5 reference:

QItemEditorFactory *QStyledItemDelegate::itemEditorFactory() const

Returns the editor factory used by the item delegate. If no editor factory is set, the function will return null.

See also setItemEditorFactory().

Upstream PySide2 reference signatures (binding differences may apply):

itemEditorFactory(self) -> PySide2.QtWidgets.QItemEditorFactory

Source: https://doc.qt.io/archives/qt-5.15/qstyleditemdelegate.html#itemEditorFactory

objectNameChanged

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

Native PythonQt.QtGui.QStyledItemDelegate.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:

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

Reimplements: QAbstractItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem \&option, const QModelIndex \&index) const.

Renders the delegate using the given painter and style option for the item specified by index.

This function paints the item using the view's QStyle.

When reimplementing paint in a subclass. Use the initStyleOption() to set up the option in the same way as the QStyledItemDelegate.

Whenever possible, use the option while painting. Especially its rect variable to decide where to draw and its state to determine if it is enabled or selected.

After painting, you should ensure that the painter is returned to the state it was supplied in when this function was called. For example, it may be useful to call QPainter::save() before painting and QPainter::restore() afterwards.

See also QItemDelegate::paint(), QStyle::drawControl(), and QStyle::CE_ItemViewItem.

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/qstyleditemdelegate.html#paint

setEditorData

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

X.setEditorData(editor, index)

Supplemental documentation: Qt 5 reference:

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

Reimplements: QAbstractItemDelegate::setEditorData(QWidget *editor, const QModelIndex \&index) const.

Sets the data to be displayed and edited by the editor from the data model item specified by the model index.

The default implementation stores the data in the editor widget's user property.

See also QMetaProperty::isUser().

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/qstyleditemdelegate.html#setEditorData

setItemEditorFactory

setItemEditorFactory(factory: Any) -> None

X.setItemEditorFactory(factory)

Supplemental documentation: Qt 5 reference:

void QStyledItemDelegate::setItemEditorFactory(QItemEditorFactory *factory)

Sets the editor factory to be used by the item delegate to be the factory specified. If no editor factory is set, the item delegate will use the default editor factory.

See also itemEditorFactory().

Upstream PySide2 reference signatures (binding differences may apply):

setItemEditorFactory(self, factory: PySide2.QtWidgets.QItemEditorFactory) -> None

Source: https://doc.qt.io/archives/qt-5.15/qstyleditemdelegate.html#setItemEditorFactory

setModelData

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

X.setModelData(editor, model, index)

Supplemental documentation: Qt 5 reference:

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

Reimplements: QAbstractItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex \&index) const.

Gets data from the editor widget and stores it in the specified model at the item index.

The default implementation gets the value to be stored in the data model from the editor widget's user property.

See also QMetaProperty::isUser().

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/qstyleditemdelegate.html#setModelData

sizeHint

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

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

Supplemental documentation: Qt 5 reference:

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

Reimplements: QAbstractItemDelegate::sizeHint(const QStyleOptionViewItem \&option, const QModelIndex \&index) const.

Returns the size needed by the delegate to display the item specified by index, taking into account the style information provided by option.

This function uses the view's QStyle to determine the size of the item.

See also QStyle::sizeFromContents() and QStyle::CT_ItemViewItem.

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/qstyleditemdelegate.html#sizeHint

sizeHintChanged

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

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

updateEditorGeometry

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

X.updateEditorGeometry(editor, option, index)

Supplemental documentation: Qt 5 reference:

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

Reimplements: QAbstractItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem \&option, const QModelIndex \&index) const.

Updates the editor for the item specified by index according to the style option given.

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/qstyleditemdelegate.html#updateEditorGeometry