summaryrefslogtreecommitdiffstats
path: root/doc/src/declarative/qdeclarativemodels.qdoc
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-07-16 10:44:09 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-07-16 10:44:09 (GMT)
commit636698a5f97401a9aeb18cd690d7f08b05dcd5e6 (patch)
tree65050b764e1aeb3f002cd929ce443cb26ff98a2a /doc/src/declarative/qdeclarativemodels.qdoc
parent8d8566d061e26f18e1bde1255fdc1375035c8eaa (diff)
parent975b1913e44128a3e9b9055f9bf2ff40d86adf2a (diff)
downloadQt-636698a5f97401a9aeb18cd690d7f08b05dcd5e6.zip
Qt-636698a5f97401a9aeb18cd690d7f08b05dcd5e6.tar.gz
Qt-636698a5f97401a9aeb18cd690d7f08b05dcd5e6.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Fix RightBearing confusion in text layout fixes, improvements for various docs and example code Fixed debugger's evaluation of dynamic properties in context Allow test to pass on smaller screens (eg. 480 high). Minor animation doc improvement
Diffstat (limited to 'doc/src/declarative/qdeclarativemodels.qdoc')
-rw-r--r--doc/src/declarative/qdeclarativemodels.qdoc16
1 files changed, 14 insertions, 2 deletions
diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc
index a2f4d3a..173002a 100644
--- a/doc/src/declarative/qdeclarativemodels.qdoc
+++ b/doc/src/declarative/qdeclarativemodels.qdoc
@@ -208,7 +208,10 @@ Models can be defined in C++ and then made available to QML. This is useful
for exposing existing C++ data models or otherwise complex datasets to QML.
A C++ model class can be defined as a QStringList, a QList<QObject*> or a
-QAbstractItemModel.
+QAbstractItemModel. The first two are useful for exposing simpler datasets,
+while QAbstractItemModel provides a more flexible solution for more complex
+models.
+
\section2 QStringList
@@ -268,7 +271,10 @@ the model by calling QDeclarativeContext::setContextProperty() again.
\section2 QAbstractItemModel
-A model can be defined by subclassing QAbstractItemModel.
+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.
The roles of a QAbstractItemModel subclass can be exposed to QML by calling
QAbstractItemModel::setRoleNames(). The default role names set by Qt are:
@@ -305,6 +311,12 @@ roles:
\snippet examples/declarative/modelviews/abstractitemmodel/view.qml 0
+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
+more information.
+
The complete example is available in Qt's \l {declarative/modelviews/abstractitemmodel}{examples/declarative/modelviews/abstractitemmodel} directory.
QAbstractItemModel presents a hierarchy of tables, but the views currently provided by QML