The KooModel class provides a QAbstractItemModel wrapper around RecordGroup class. More...
Public Member Functions | |
| def | setRecordGroup |
| Sets the RecordGroup associated with this Qt Model. | |
| def | recordGroup |
| Returns the current RecordGroup associated with this Qt Model. | |
| def | setReadOnly |
| Sets the model as read-only. | |
| def | isReadOnly |
| Returns whether the model is read-only or read-write. | |
| def | setFields |
| Sets the dictionary of fields that should be loaded. | |
| def | setFieldsOrder |
| Sets the order in which fields should be put in the model. | |
| def | setColors |
| Sets the dictionary of colors. | |
| def | setShowBackgroundColor |
| Sets whether the background color should be returned in data() or not. | |
| def | setIconForField |
| Sets that the contents of field 'icon' are used as an icon for field 'iconField'. | |
| def | setChildrenForField |
| Sets that the children of field 'child' are used as an children for field 'childField'. | |
| def | setMode |
| Set the model to the specified mode. | |
| def | setShowToolTips |
| Sets whether tooltips should be shown or not. | |
| def | id |
| Returns the model id corresponding to index. | |
| def | field |
| Returns the field name for the given column. | |
| def | fieldType |
| Returns the field type for the given column and group. | |
| def | fieldTypeByName |
| Returns the field type for the given column and group. | |
| def | record |
| Returns a Record refered by row and group parameters. | |
| def | value |
| Returns the value from the model from the given row, column and group. | |
| def | id |
| Returns the id of the model pointed by index. | |
| def | indexFromId |
| Returns a QModelIndex pointing to the first field of a given record id. | |
| def | indexFromRecord |
| Returns a QModelIndex pointing to the first field of a given record. | |
The KooModel class provides a QAbstractItemModel wrapper around RecordGroup class.
To use this class, simply call setRecordGroup() to set the RecordGroup instance to wrap, and setFields() with the fields to load. Then it's ready to be used in any Qt model/view enabled widget such as QTreeView or QListView. Note that by default KooModel is read-only.
Definition at line 53 of file KooModel.py.
| def Koo::Model::KooModel::KooModel::id | ( | self, | ||
| index | ||||
| ) |
Returns the id of the model pointed by index.
The index can point to any field of the model.
Definition at line 703 of file KooModel.py.
| def Koo::Model::KooModel::KooModel::isReadOnly | ( | self | ) |
Returns whether the model is read-only or read-write.
Definition at line 121 of file KooModel.py.
| def Koo::Model::KooModel::KooModel::setColors | ( | self, | ||
| colors | ||||
| ) |
Sets the dictionary of colors.
The dictionary is of the form 'color' : 'expression', where 'expression' is a python boolean expression that will be passed to the model, and thus can use model context information.
Definition at line 164 of file KooModel.py.
| def Koo::Model::KooModel::KooModel::setFieldsOrder | ( | self, | ||
| fields | ||||
| ) |
Sets the order in which fields should be put in the model.
If this function is never called fields are put in alphabetical order.
Definition at line 155 of file KooModel.py.
| def Koo::Model::KooModel::KooModel::setIconForField | ( | self, | ||
| icon, | ||||
| iconField | ||||
| ) |
Sets that the contents of field 'icon' are used as an icon for field 'iconField'.
The contents (usually an icon name) of the field 'icon' is used for the decoration role of 'iconField'
Definition at line 181 of file KooModel.py.
| def Koo::Model::KooModel::KooModel::setMode | ( | self, | ||
| mode | ||||
| ) |
Set the model to the specified mode.
mode parameter can be TreeMode or ListMode, this is not 100 necessary in most cases, but it also avoids some checks in many cases so at least it can provide some speed improvements.
Definition at line 208 of file KooModel.py.
| def Koo::Model::KooModel::KooModel::setReadOnly | ( | self, | ||
| value | ||||
| ) |
Sets the model as read-only.
Definition at line 117 of file KooModel.py.
| def Koo::Model::KooModel::KooModel::setRecordGroup | ( | self, | ||
| group | ||||
| ) |
Sets the RecordGroup associated with this Qt Model.
Fields should already be set and can't be added after this call
Definition at line 94 of file KooModel.py.
| def Koo::Model::KooModel::KooModel::setShowBackgroundColor | ( | self, | ||
| showBackgroundColor | ||||
| ) |
Sets whether the background color should be returned in data() or not.
Setting this to True (default) will make the call to data() with Qt.BackgroundRole to return the appropiate background color if fields are read only or required.
Definition at line 173 of file KooModel.py.
| def Koo::Model::KooModel::KooModel::setShowToolTips | ( | self, | ||
| show | ||||
| ) |
Sets whether tooltips should be shown or not.
Definition at line 212 of file KooModel.py.
| def Koo::Model::KooModel::KooModel::value | ( | self, | ||
| row, | ||||
| column, | ||||
| group | ||||
| ) |
Returns the value from the model from the given row, column and group.
'group' is usually obtained from the internalPointer() of a QModelIndex.
Definition at line 665 of file KooModel.py.