delegate
delegate
Attributes
INT_LIMIT = 2 ** 31 - 1
module-attribute
Classes
ValueDelegate
Bases: QStyledItemDelegate
Creates the editor matching the type of each value.
Methods:
createEditor(parent, option, index)
Create the editor matching the value's type.
Color values open a color dialog instead and return None, as do types without an inline editor (dict, list, null, binary).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QWidget
|
Parent of the editor. |
required |
option
|
QStyleOptionViewItem
|
Style options of the cell. |
required |
index
|
QModelIndex
|
The cell being edited. |
required |
Returns:
| Type | Description |
|---|---|
QWidget | None
|
QtWidgets.QWidget | None: The editor, or None if there is no inline editor. |
Source code in src/json_config_qt/tree/delegate.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
initStyleOption(option, index)
Italicize null values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
option
|
QStyleOptionViewItem
|
The options to fill in. |
required |
index
|
QModelIndex
|
The cell being painted. |
required |
Source code in src/json_config_qt/tree/delegate.py
125 126 127 128 129 130 131 132 133 134 | |
setEditorData(editor, index)
Load the cell's value into the editor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
editor
|
QWidget
|
The editor created by createEditor. |
required |
index
|
QModelIndex
|
The cell being edited. |
required |
Source code in src/json_config_qt/tree/delegate.py
80 81 82 83 84 85 86 87 88 89 90 91 | |
setModelData(editor, model, index)
Write the editor's value back to the model.
Invalid integer text is ignored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
editor
|
QWidget
|
The editor created by createEditor. |
required |
model
|
QAbstractItemModel
|
The model to update. |
required |
index
|
QModelIndex
|
The cell being edited. |
required |
Source code in src/json_config_qt/tree/delegate.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
updateEditorGeometry(editor, option, index)
Make the editor fill its cell.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
editor
|
QWidget
|
The editor created by createEditor. |
required |
option
|
QStyleOptionViewItem
|
Style options of the cell. |
required |
index
|
QModelIndex
|
The cell being edited. |
required |
Source code in src/json_config_qt/tree/delegate.py
115 116 117 118 119 120 121 122 123 | |