diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-03-15 04:22:49 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-03-15 04:22:49 (GMT) |
commit | 29edb69a909126448c4c73b2c216d0ccb7981418 (patch) | |
tree | 85a5f5f1ee26851f0af0c1b25ee8c6aeff46bc1f | |
parent | b55f19b956958dc94e8f35e7dc215a70445759a4 (diff) | |
download | Qt-29edb69a909126448c4c73b2c216d0ccb7981418.zip Qt-29edb69a909126448c4c73b2c216d0ccb7981418.tar.gz Qt-29edb69a909126448c4c73b2c216d0ccb7981418.tar.bz2 |
Little more doc on QabstractItemModel and QML.
-rw-r--r-- | doc/src/declarative/qdeclarativemodels.qdoc | 20 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 6 |
2 files changed, 21 insertions, 5 deletions
diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index f7d1a73..e80824d 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -191,6 +191,23 @@ will be positioned by the view. \section2 QAbstractItemModel QAbstractItemModel provides the roles set via the QAbstractItemModel::setRoleNames() method. +The default role names set by Qt are: + +\table +\header +\o Qt Role +\o QML Role Name +\row +\o Qt::DisplayRole +\o display +\row +\o Qt::DecorationRole +\o decoration +\endtable + +QAbstractItemModel presents a heirachy of tables. Views currently provided by QML +can only display list data. In order to display child lists of a heirachical model +use the VisualDataModel element with \e rootIndex set to a parent node. \section2 QStringList @@ -198,9 +215,6 @@ QAbstractItemModel provides the roles set via the QAbstractItemModel::setRoleNam QStringList provides the contents of the list via the \e modelData role: \table -\header -\o -\o \row \o \code diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 72335d4..60dcc36 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -673,14 +673,16 @@ void QDeclarativeEngine::setContextForObject(QObject *object, QDeclarativeContex Ownership controls whether or not QML automatically destroys the QObject when the object is garbage collected by the JavaScript engine. The two ownership options are: -\o CppOwnership The object is owned by C++ code, and will never be deleted by QML. The +\list +\o CppOwnership - The object is owned by C++ code, and will never be deleted by QML. The JavaScript destroy() method cannot be used on objects with CppOwnership. This option is similar to QScriptEngine::QtOwnership. -\o JavaScriptOwnership The object is owned by JavaScript. When the object is returned to QML +\o JavaScriptOwnership - The object is owned by JavaScript. When the object is returned to QML as the return value of a method call or property access, QML will delete the object if there are no remaining JavaScript references to it and it has no QObject::parent(). This option is similar to QScriptEngine::ScriptOwnership. +\endlist Generally an application doesn't need to set an object's ownership explicitly. QML uses a heuristic to set the default object ownership. By default, an object that is created by |