From 530b30ae175ec33f87dd1559809a2b6b83c63321 Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Tue, 5 Feb 2013 16:14:32 +0100 Subject: 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 --- .../doc/src/concepts/modelviewsdata/cppmodels.qdoc | 42 +++++++++++++--------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'src/quick/doc') 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 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 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. -- cgit v1.2.3 From cf3327cfbe861c0ee33008df20a53949034ac95e Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Thu, 14 Feb 2013 15:01:52 +0100 Subject: Doc: Removed reference to deprecated \badcode command. QDoc doesn't differentiate between \badcode and \code. They both look the same in the output. Change-Id: Ia0580f7d664ad5e33b48d6511dac7c61349cacce Reviewed-by: Martin Smith Reviewed-by: Jerome Pasion --- src/quick/doc/src/concepts/positioning/anchors.qdoc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/quick/doc') diff --git a/src/quick/doc/src/concepts/positioning/anchors.qdoc b/src/quick/doc/src/concepts/positioning/anchors.qdoc index 871cd526d0..d0a14f7392 100644 --- a/src/quick/doc/src/concepts/positioning/anchors.qdoc +++ b/src/quick/doc/src/concepts/positioning/anchors.qdoc @@ -140,7 +140,8 @@ carefully ordered, or they may produce unexpected outcomes. The following exampl \table \row \li - \badcode + \code + //bad code Rectangle { width: 50 anchors.left: parent.left @@ -185,7 +186,8 @@ conditional bindings, as this can lead to the ordering issue described above. In the Rectangle will eventually grow to the full width of its parent, because both left and right anchors will be simultaneously set during binding update. -\badcode +\code +//bad code Rectangle { width: 50; height: 50 anchors.left: state == "right" ? undefined : parent.left; @@ -201,7 +203,8 @@ ordering issues internally. For performance reasons, you can only anchor an item to its siblings and direct parent. For example, the following anchor is invalid and would produce a warning: -\badcode +\code +//bad code Item { id: group1 Rectangle { id: rect1; ... } -- cgit v1.2.3 From 7726da293c4e54aedb1ef69138f168d59692c1e8 Mon Sep 17 00:00:00 2001 From: Marcel Krems Date: Thu, 7 Feb 2013 04:06:02 +0100 Subject: Doc: Correcting typo "without with" Change-Id: Ibacbb9aefe9a333994014aec17a0079477a4618f Reviewed-by: Jerome Pasion --- src/quick/doc/src/appdevguide/internationalization.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick/doc') diff --git a/src/quick/doc/src/appdevguide/internationalization.qdoc b/src/quick/doc/src/appdevguide/internationalization.qdoc index c9bec86ebd..bf6b667a01 100644 --- a/src/quick/doc/src/appdevguide/internationalization.qdoc +++ b/src/quick/doc/src/appdevguide/internationalization.qdoc @@ -262,7 +262,7 @@ SOURCES = main.qml \ \endcode -You can also specify the .qml source files without with a wildcard match. The +You can also specify the .qml source files with a wildcard match. The search is not recursive so you need to specify each directory where there are user interface strings in the source code: -- cgit v1.2.3