aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVenugopal Shivashankar <venugopal.shivashankar@digia.com>2013-02-05 16:14:32 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-08 09:43:45 +0100
commit530b30ae175ec33f87dd1559809a2b6b83c63321 (patch)
tree0505e4479034315bf3ac9ae55c146e0292eef3de
parent1d29d8edf8e4e709ca2f27791cdf8672c15488f3 (diff)
Doc: Removed reference to QAbstractItemModel::setRoleNames()
This function is deprecated and it is recommended to reimplement QAbstractItemModel::roleNames() instead. Task-number: QTBUG-29456 Change-Id: Ib28759fe2349edd32a1b87bac04eb44d625d3e60 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
-rw-r--r--src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
index e2753e47f4..8571879f78 100644
--- a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
+++ b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
@@ -56,7 +56,9 @@ to a QStringList:
\snippet quick/models/stringlistmodel/main.cpp 0
-The complete example is available in Qt's \l {quick/modelviews/stringlistmodel}{examples/quick/modelviews/stringlistmodel} directory.
+The complete source code for this example is available in
+\l {quick/modelviews/stringlistmodel}{examples/quick/modelviews/stringlistmodel}
+within the Qt install directory.
\b{Note:} There is no way for the view to know that the contents of a QStringList
have changed. If the QStringList changes, it will be necessary to reset
@@ -68,7 +70,7 @@ the model by calling QQmlContext::setContextProperty() again.
A list of QObject* values can also be used as a model. A QList<QObject*> provides
the properties of the objects in the list as roles.
-The following application creates a \c DataObject class that with
+The following application creates a \c DataObject class with
Q_PROPERTY values that will be accessible as named roles when a
QList<DataObject*> is exposed to QML:
@@ -86,15 +88,17 @@ the ListView delegate:
\snippet quick/models/objectlistmodel/view.qml 0
-Note the use of the fully qualified access to the \c color property.
+Note the use of \c color property with qualifier.
The properties of the object are not replicated in the \c model
-object, since they are easily available via the \c modelData
+object, as they are easily available via the \c modelData
object.
-The complete example is available in Qt's \l {quick/modelviews/objectlistmodel}{examples/quick/modelviews/objectlistmodel} directory.
+The complete source code for this example is available in
+\l {quick/modelviews/objectlistmodel}{examples/quick/modelviews/objectlistmodel}
+within the Qt install directory.
Note: There is no way for the view to know that the contents of a QList
-have changed. If the QList changes, it will be necessary to reset
+has changed. If the QList changes, it is necessary to reset
the model by calling QQmlContext::setContextProperty() again.
@@ -103,10 +107,11 @@ the model by calling QQmlContext::setContextProperty() again.
A model can be defined by subclassing QAbstractItemModel. This is the
best approach if you have a more complex model that cannot be supported
by the other approaches. A QAbstractItemModel can also automatically
-notify a QML view when the model data has changed.
+notify a QML view when the model data changes.
-The roles of a QAbstractItemModel subclass can be exposed to QML by calling
-QAbstractItemModel::setRoleNames(). The default role names set by Qt are:
+The roles of a QAbstractItemModel subclass can be exposed to QML by
+reimplementing QAbstractItemModel::roleNames(). The default role names
+set by Qt are:
\table
\header
@@ -120,9 +125,10 @@ QAbstractItemModel::setRoleNames(). The default role names set by Qt are:
\li decoration
\endtable
-Here is an application with a QAbstractListModel subclass named \c AnimalModel
-that has \e type and \e size roles. It reimplements QAbstractItemModel::roleNames() to set the
-role names for accessing the properties via QML:
+Here is an application with a QAbstractListModel subclass named \c AnimalModel,
+which exposes the \e type and \e sizes roles. It reimplements
+QAbstractItemModel::roleNames() to expose the role names, so that they can be
+accessed via QML:
\snippet quick/models/abstractitemmodel/model.h 0
\dots
@@ -143,16 +149,18 @@ roles:
QML views are automatically updated when the model changes. Remember the model
must follow the standard rules for model changes and notify the view when
the model has changed by using QAbstractItemModel::dataChanged(),
-QAbstractItemModel::beginInsertRows(), etc. See the \l {Model subclassing reference} for
+QAbstractItemModel::beginInsertRows(), and so on. See the \l {Model subclassing reference} for
more information.
-The complete example is available in Qt's \l {quick/modelviews/abstractitemmodel}{examples/quick/modelviews/abstractitemmodel} directory.
+The complete source code for this example is available in
+\l {quick/modelviews/abstractitemmodel}{examples/quick/modelviews/abstractitemmodel}
+within the Qt install directory.
QAbstractItemModel presents a hierarchy of tables, but the views currently provided by QML
can only display list data.
-In order to display child lists of a hierarchical model
-the VisualDataModel element provides several properties and functions for use
-with models of type QAbstractItemModel:
+In order to display the child lists of a hierarchical model,
+use the VisualDataModel type, which provides the following properties and functions to be used
+with list models of QAbstractItemModel type:
\list
\li \e hasModelChildren role property to determine whether a node has child nodes.