diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/classes/qnamespace.qdoc | 39 | ||||
-rw-r--r-- | doc/src/model-view-programming.qdoc | 2 |
2 files changed, 24 insertions, 17 deletions
diff --git a/doc/src/classes/qnamespace.qdoc b/doc/src/classes/qnamespace.qdoc index 48f18d0..79a4560 100644 --- a/doc/src/classes/qnamespace.qdoc +++ b/doc/src/classes/qnamespace.qdoc @@ -2464,44 +2464,46 @@ Each item in the model has a set of data elements associated with it, each with its own role. The roles are used by the view to indicate - to the model which type of data it needs. + to the model which type of data it needs. Custom models should return + data in these types. - The general purpose roles are: + The general purpose roles (and the associated types) are: - \value DisplayRole The key data to be rendered in the form of text. + \value DisplayRole The key data to be rendered in the form of text. (QString) \value DecorationRole The data to be rendered as a decoration in the form - of an icon. + of an icon. (QColor) \value EditRole The data in a form suitable for editing in an - editor. - \value ToolTipRole The data displayed in the item's tooltip. - \value StatusTipRole The data displayed in the status bar. + editor. (QString) + \value ToolTipRole The data displayed in the item's tooltip. (QString) + \value StatusTipRole The data displayed in the status bar. (QString) \value WhatsThisRole The data displayed for the item in "What's This?" - mode. + mode. (QString) \value SizeHintRole The size hint for the item that will be supplied - to views. + to views. (QSize) - Roles describing appearance and meta data: + Roles describing appearance and meta data (with associated types): \value FontRole The font used for items rendered with the default - delegate. + delegate. (QFont) \value TextAlignmentRole The alignment of the text for items rendered with the - default delegate. + default delegate. (Qt::AlignmentFlag) \value BackgroundRole The background brush used for items rendered with - the default delegate. + the default delegate. (QBrush) \value BackgroundColorRole This role is obsolete. Use BackgroundRole instead. \value ForegroundRole The foreground brush (text color, typically) used for items rendered with the default delegate. + (QBrush) \value TextColorRole This role is obsolete. Use ForegroundRole instead. \value CheckStateRole This role is used to obtain the checked state of - an item (see \l Qt::CheckState). + an item. (Qt::CheckState) - Accessibility roles: + Accessibility roles (with associated types): \value AccessibleTextRole The text to be used by accessibility extensions and plugins, such as screen - readers. + readers. (QString) \value AccessibleDescriptionRole A description of the item for accessibility - purposes. + purposes. (QString) User roles: @@ -2512,6 +2514,9 @@ \omitvalue ToolTipPropertyRole \omitvalue StatusTipPropertyRole \omitvalue WhatsThisPropertyRole + + For user roles, it is up to the developer to decide which types to use and ensure that + components use the correct types when accessing and setting data. */ /*! diff --git a/doc/src/model-view-programming.qdoc b/doc/src/model-view-programming.qdoc index 49214e0..13f5e5a 100644 --- a/doc/src/model-view-programming.qdoc +++ b/doc/src/model-view-programming.qdoc @@ -2148,6 +2148,8 @@ need to supply data for Qt::DisplayRole and any application-specific user roles, but it is also good practice to provide data for Qt::ToolTipRole, Qt::AccessibleTextRole, and Qt::AccessibleDescriptionRole. + See the Qt::ItemDataRole enum documentation for information about the types + associated with each role. \row \o \l{QAbstractItemModel::headerData()}{headerData()} \o Provides views with information to show in their headers. The information is only retrieved by views that can display header information. |