summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qabstractitemmodel.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-01-21 17:57:54 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-21 17:57:54 +0100
commit46791c08e17740418cc701b8862a980c0f711b87 (patch)
treebedba63fc48b80c2a2df54ea91c3f35398953aac /src/corelib/itemmodels/qabstractitemmodel.cpp
parentb8a38a6737acd670d92197ca5b009590d9fd8a9c (diff)
parent9033977d3971db5352a2bb51052a723a2ac57a8f (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/corelib/itemmodels/qabstractitemmodel.cpp')
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index ab257a996d..4241fe08ca 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -2334,6 +2334,31 @@ void QAbstractItemModel::doSetRoleNames(const QHash<int,QByteArray> &roleNames)
Returns the model's role names.
+ The default role names set by Qt are:
+
+ \table
+ \header
+ \li Qt Role
+ \li QML Role Name
+ \row
+ \li Qt::DisplayRole
+ \li display
+ \row
+ \li Qt::DecorationRole
+ \li decoration
+ \row
+ \li Qt::EditRole
+ \li edit
+ \row
+ \li Qt::ToolTipRole
+ \li toolTip
+ \row
+ \li Qt::StatusTipRole
+ \li statusTip
+ \row
+ \li Qt::WhatsThisRole
+ \li whatsThis
+ \endtable
*/
QHash<int,QByteArray> QAbstractItemModel::roleNames() const
{
@@ -3378,6 +3403,9 @@ Qt::ItemFlags QAbstractTableModel::flags(const QModelIndex &index) const
of the rowCount() and data() functions. Well behaved models also provide
a headerData() implementation.
+ If your model is used within QML and requires roles other than the
+ default ones provided by the roleNames() function, you must override it.
+
For editable list models, you must also provide an implementation of
setData(), implement the flags() function so that it returns a value
containing \l{Qt::ItemFlags}{Qt::ItemIsEditable}.