summaryrefslogtreecommitdiffstats
path: root/doc/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-18 07:00:40 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-18 07:00:40 (GMT)
commitba9218a9786abddd461034b5aeb1d5a39f8072f9 (patch)
treec494a78c355803285e4efa4e9d489babb9cd8fea /doc/src
parent379b4dc81177b95c15de30c5925efca1136e4041 (diff)
parent633a5cf6d8197105d6392dbf56bf0f29f9c84da1 (diff)
downloadQt-ba9218a9786abddd461034b5aeb1d5a39f8072f9.zip
Qt-ba9218a9786abddd461034b5aeb1d5a39f8072f9.tar.gz
Qt-ba9218a9786abddd461034b5aeb1d5a39f8072f9.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: (22 commits) Regression fix for Loader anchors not working Make Qt.include() work for js files that have '.pragma library' doc fix Improve docs for Qt.quit() Prevent assignment of values (string, number, bool) to signal handlers. Make sure strings are escaped when returned via asScript. Documentation git ignore stuff Test Qt.labs.folderlistmodel plugin Fix naming. Sometimes you own QNetworkReply, sometimes you don't. Rename files; fix test. Add parent parameter to QDeclarativeExpression constructor. Round correctly in binding optimizer Don't disable SmoothPixmapTransform in qDrawBorderPixmap() Photoviewer example fixes. Port from QListModelInterface to QAbstractListModel. Use QDeclarativeScriptString for ParentChange. Set raster + gl viewport as the default for OS X. Move stuff from QML viewer to plugins. ...
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/declarative/examples.qdoc4
-rw-r--r--doc/src/declarative/extending.qdoc5
-rw-r--r--doc/src/declarative/globalobject.qdoc5
-rw-r--r--doc/src/declarative/qdeclarativemodels.qdoc23
-rw-r--r--doc/src/examples/qml-examples.qdoc7
-rw-r--r--doc/src/examples/qml-rssnews.qdoc49
-rw-r--r--doc/src/images/qml-rssnews-example.pngbin0 -> 143314 bytes
7 files changed, 79 insertions, 14 deletions
diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc
index cdc308a..a65614e 100644
--- a/doc/src/declarative/examples.qdoc
+++ b/doc/src/declarative/examples.qdoc
@@ -122,7 +122,6 @@ For example, from your build directory, run:
\section2 XML
\list
-\o \l{declarative/xml/xmldata}{XML data}
\o \l{declarative/xml/xmlhttprequest}{XmlHttpRequest}
\endlist
@@ -161,9 +160,10 @@ For example, from your build directory, run:
\list
\o \l{demos/declarative/calculator}{Calculator}
+\o \l{demos/declarative/flickr}{Flickr Mobile}
\o \l{demos/declarative/minehunt}{Minehunt}
\o \l{demos/declarative/photoviewer}{Photo Viewer}
-\o \l{demos/declarative/flickr}{Flickr Mobile}
+\o \l{demos/declarative/rssnews}{RSS News Reader}
\o \l{demos/declarative/samegame}{Same Game}
\o \l{demos/declarative/snake}{Snake}
\endlist
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc
index 5b695f7..574b0b2 100644
--- a/doc/src/declarative/extending.qdoc
+++ b/doc/src/declarative/extending.qdoc
@@ -61,8 +61,11 @@ QML for their own independent use.
The QML snippet shown above instantiates one \c Person instance and sets
the \c name and \c shoeSize properties on it. Everything in QML ultimately comes down
to either instantiating an object instance, or assigning a property a value.
+
QML relies heavily on Qt's meta object system and can only instantiate classes
-that derive from QObject.
+that derive from QObject. For visual element types, this will usually mean a subclass
+of QDeclarativeItem; for models used with the view elements, a subclass of QAbstractItemModel;
+and for abitrary objects with properties, a direct subclass of QObject.
The QML engine has no intrinsic knowledge of any class types. Instead the
programmer must register the C++ types with their corresponding QML names.
diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc
index 2a83e30..c29a796 100644
--- a/doc/src/declarative/globalobject.qdoc
+++ b/doc/src/declarative/globalobject.qdoc
@@ -219,8 +219,9 @@ Binary to ASCII - this function returns a base64 encoding of \c data.
ASCII to binary - this function returns a base64 decoding of \c data.
\section3 Qt.quit()
-This function causes the QML engine to emit the quit signal, which in
-\l {Qt Declarative UI Runtime}{qml} causes the runtime to quit.
+This function causes the QDeclarativeEngine::quit() signal to be emitted.
+Within the \l {Qt Declarative UI Runtime}{qml} application this causes the
+launcher application to exit.
\section3 Qt.resolvedUrl(url)
This function returns \c url resolved relative to the URL of the
diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc
index 788d417..109d390 100644
--- a/doc/src/declarative/qdeclarativemodels.qdoc
+++ b/doc/src/declarative/qdeclarativemodels.qdoc
@@ -99,7 +99,8 @@ There are a number of QML elements that operate using data models:
\endlist
QML supports several types of data model, which may be provided by QML
-or C++ (via QDeclarativeContext::setContextProperty(), for example).
+or C++ (via QDeclarativeContext::setContextProperty() or as plugin types,
+for example).
\section1 QML Data Models
@@ -210,8 +211,13 @@ will be positioned by the view.
\section1 C++ Data Models
+Models defined in C++ can be made available to QML either from a C++ application or from a
+\l{QDeclarativeExtensionPlugin}{QML C++ plugin}.
+
\section2 QAbstractItemModel
+A model can be defined by subclassing QAbstractItemModel.
+
QAbstractItemModel provides the roles set via the QAbstractItemModel::setRoleNames() method.
The default role names set by Qt are:
@@ -227,7 +233,18 @@ The default role names set by Qt are:
\o decoration
\endtable
-QAbstractItemModel presents a heirachy of tables. Views currently provided by QML
+The model could be made available to QML either directly:
+
+\code
+QDeclarativeContext *ctxt = view.rootContext();
+MyModel *model = new MyModel; // subclass of QAbstractItemModel
+ctxt->setContextProperty("myModel", model);
+\endcode
+
+or by registering the subclass as a new QML type in
+a \l{QDeclarativeExtensionPlugin}{QML C++ plugin}.
+
+QAbstractItemModel presents a heirachy of tables, but views currently provided by QML
can only display list data.
In order to display child lists of a heirachical model
the VisualDataModel element provides several properties and functions for use
@@ -242,7 +259,7 @@ with models of type QAbstractItemModel:
\section2 QStringList
-QStringList provides the contents of the list via the \e modelData role:
+A model may be a simple QStringList, which provides the contents of the list via the \e modelData role:
\table
\row
diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc
index 22113ee..cad713e 100644
--- a/doc/src/examples/qml-examples.qdoc
+++ b/doc/src/examples/qml-examples.qdoc
@@ -175,7 +175,7 @@
*/
/*!
- \title Threaded ListModel
+ \title Threaded ListModel
\example declarative/threading/threadedlistmodel
*/
@@ -268,11 +268,6 @@
*/
/*!
- \title XML Data
- \example declarative/xml/xmldata
-*/
-
-/*!
\title XMLHttpRequest
\example declarative/xml/xmlhttprequest
*/
diff --git a/doc/src/examples/qml-rssnews.qdoc b/doc/src/examples/qml-rssnews.qdoc
new file mode 100644
index 0000000..0e7bdef
--- /dev/null
+++ b/doc/src/examples/qml-rssnews.qdoc
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \title RSS News
+ \example demos/declarative/rssnews
+
+ This demo shows how to write a RSS news reader in QML.
+
+ \image qml-rssnews-example.png
+*/
diff --git a/doc/src/images/qml-rssnews-example.png b/doc/src/images/qml-rssnews-example.png
new file mode 100644
index 0000000..948ef4d
--- /dev/null
+++ b/doc/src/images/qml-rssnews-example.png
Binary files differ