diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-05-26 22:59:51 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-05-26 22:59:51 (GMT) |
commit | a9462494b6eb5e07f8320cf7d99bdad9c9917434 (patch) | |
tree | 09ebfbdc94e04278414608ef09125b0ac8fc6646 /doc | |
parent | a5391f187b91aaf9d6932f2ad1e81701e6cd0352 (diff) | |
parent | 124efaa694316a4e02684fde151395d8e1d28b7a (diff) | |
download | Qt-a9462494b6eb5e07f8320cf7d99bdad9c9917434.zip Qt-a9462494b6eb5e07f8320cf7d99bdad9c9917434.tar.gz Qt-a9462494b6eb5e07f8320cf7d99bdad9c9917434.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/declarative/advtutorial.qdoc | 4 | ||||
-rw-r--r-- | doc/src/declarative/dynamicobjects.qdoc | 14 | ||||
-rw-r--r-- | doc/src/declarative/examples.qdoc | 23 | ||||
-rw-r--r-- | doc/src/declarative/globalobject.qdoc | 2 | ||||
-rw-r--r-- | doc/src/declarative/qtdeclarative.qdoc | 4 | ||||
-rw-r--r-- | doc/src/snippets/declarative/gradient.qml | 2 | ||||
-rw-r--r-- | doc/src/snippets/declarative/texteditor.qml | 8 | ||||
-rw-r--r-- | doc/src/snippets/declarative/xmlrole.qml | 81 | ||||
-rw-r--r-- | doc/src/snippets/declarative/xmlrole.xml | 14 |
9 files changed, 130 insertions, 22 deletions
diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index 47504ae..abfeadb 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -178,7 +178,7 @@ The \c createBlock() function creates a block from the \c Block.qml file and moves the new block to its position on the game canvas. This involves several steps: \list -\o \l {Qt.createComponent(url file)}{Qt.createComponent()} is called to generate an element from \c Block.qml. +\o \l {Qt::createComponent()}{Qt.createComponent()} is called to generate an element from \c Block.qml. If the component is ready, we can call \c createObject() to create an instance of the \c Block item. \o If \c createObject() returned null (i.e. if there was an error while loading the object), print the error information. @@ -468,6 +468,6 @@ By following this tutorial you've seen how you can write a fully functional appl \endlist There is so much more to learn about QML that we haven't been able to cover in this tutorial. Check out all the -demos and examples and the \l {Declarative UI Using QML}{documentation} to find out all the things you can do with QML! +demos and examples and the \l {Qt Quick}{documentation} to find out all the things you can do with QML! */ diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc index 633489b..5e606f4 100644 --- a/doc/src/declarative/dynamicobjects.qdoc +++ b/doc/src/declarative/dynamicobjects.qdoc @@ -56,15 +56,15 @@ application, and there are no C++ components involved. \section1 Creating Objects Dynamically There are two ways to create objects dynamically from JavaScript. You can either call -\l {Qt.createComponent(url file)}{Qt.createComponent()} to create -a component which instantiates items, or use \l{Qt.createQmlObject(string qml, object parent, string filepath)}{Qt.createQmlObject()} +\l {Qt::createComponent()}{Qt.createComponent()} to create +a component which instantiates items, or use \l{Qt::createQmlObject()}{Qt.createQmlObject()} to create an item from a string of QML. Creating a component is better if you have a predefined item, and you want to create dynamic instances of that item; creating an item from a string of QML is useful when the item QML itself is generated at runtime. If you have a component specified in a QML file, you can dynamically load it with -the \l {Qt.createComponent(url file)}{Qt.createComponent()} function on the \l{QML Global Object}. +the \l {Qt::createComponent()}{Qt.createComponent()} function on the \l{QML Global Object}. This function takes the URL of the QML file as its only argument and returns a component object which can be used to create and load that QML file. @@ -98,10 +98,10 @@ in \c main.qml). After creating an item, you must set its parent to an item with Otherwise your dynamically created item will not appear in the scene. When using files with relative paths, the path should -be relative to the file where \l {Qt.createComponent(url file)}{Qt.createComponent()} is executed. +be relative to the file where \l {Qt::createComponent()}{Qt.createComponent()} is executed. If the QML component does not exist until runtime, you can create a QML item from -a string of QML using the \l{Qt.createQmlObject(string qml, object parent, string filepath)}{Qt.createQmlObject()} function, as in the following example: +a string of QML using the \l{Qt::createQmlObject()}{Qt.createQmlObject()} function, as in the following example: \snippet doc/src/snippets/declarative/createQmlObject.qml 0 @@ -121,9 +121,9 @@ the bindings in the dynamic item will no longer work. The actual creation context depends on how an item is created: \list -\o If \l {Qt.createComponent(url file)}{Qt.createComponent()} is used, the creation context +\o If \l {Qt::createComponent()}{Qt.createComponent()} is used, the creation context is the QDeclarativeContext in which this method is called -\o If \l{Qt.createQmlObject(string qml, object parent, string filepath)}{Qt.createQmlObject()} +\o If \l{Qt::createQmlObject()}{Qt.createQmlObject()} if called, it is the context of the item used as the second argument to this method \o If a \c {Component{}} item is defined and \l {Component::createObject()}{createObject()} is called on that item, it is the context in which the \c Component is defined diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index 6e0426c..5cb83fa 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -84,7 +84,10 @@ For example, from your build directory, run: \o \l{declarative/imageelements/borderimage}{BorderImage} \endlist -\section2 \l{declarative/positioners}{Positioners} +\section2 Positioners +\list +\o \l{declarative/positioners}{Example} +\endlist \section2 Key Interaction \list @@ -99,6 +102,7 @@ For example, from your build directory, run: \section2 UI Components \list +\o \l{declarative/ui-components/dialcontrol}{Dial control} \o \l{declarative/ui-components/flipable}{Flipable} \o \l{declarative/ui-components/progressbar}{Progress bar} \o \l{declarative/ui-components/scrollbar}{Scroll bar} @@ -112,10 +116,10 @@ For example, from your build directory, run: \list \o \l{declarative/modelviews/gridview}{GridView} \o \l{declarative/modelviews/listview}{ListView} -\o \l{declarative/modelviews/objectlistmodel}{Object list model} +\o \l{declarative/modelviews/objectlistmodel}{Object ListModel} \o \l{declarative/modelviews/package}{Package} \o \l{declarative/modelviews/parallax}{Parallax} -\o \l{declarative/modelviews/stringlistmodel}{String list model} +\o \l{declarative/modelviews/stringlistmodel}{String ListModel} \o \l{declarative/modelviews/webview}{WebView} \endlist @@ -124,7 +128,10 @@ For example, from your build directory, run: \o \l{declarative/xml/xmlhttprequest}{XmlHttpRequest} \endlist -\section2 \l{declarative/i18n}{Internationalization (i18n)} +\section2 Internationalization (i18n) +\list +\o \l{declarative/i18n}{Example} +\endlist \section2 Threading \list @@ -132,11 +139,14 @@ For example, from your build directory, run: \o \l{declarative/threading/workerscript}{WorkerScript} \endlist -\section2 \l{declarative/sqllocalstorage}{SQL Local Storage} +\section2 SQL Local Storage +\list +\o \l{declarative/sqllocalstorage}{Example} +\endlist \section2 C++ Extensions \list -\o \l{declarative-cppextensions-reference.html}{Reference examples} (discussed in \l {Extending QML in C++}) +\o \l{declarative-cppextensions-reference.html}{Reference examples} \o \l{declarative/cppextensions/plugins}{Plugins} \o \l{declarative-cppextensions-qgraphicslayouts.html}{QGraphicsLayouts} \o \l{declarative/cppextensions/qwidgets}{QWidgets} @@ -148,7 +158,6 @@ For example, from your build directory, run: \list \o \l{declarative/toys/clocks}{Clocks} \o \l{declarative/toys/corkboards}{Corkboards} -\o \l{declarative/toys/dial}{Dial} \o \l{declarative/toys/dynamicscene}{Dynamic Scene} \o \l{declarative/toys/tic-tac-toe}{Tic Tac Toe} \o \l{declarative/toys/tvtennis}{TV Tennis} diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index fcd227d..7d4f9b9 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -49,7 +49,7 @@ Contains all the properties of the JavaScript global object, plus: \section1 Qt Object -The \l{qt-qml.html}{Qt object} provides useful enums and functions from Qt, for use in all QML +The \l{qml-qt.html}{Qt object} provides useful enums and functions from Qt, for use in all QML files. \section1 XMLHttpRequest diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index c47ab23..f7cb722 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -112,7 +112,7 @@ Returns the QML type id. - \sa qmlRegisterTypeNotAvailable + \sa qmlRegisterTypeNotAvailable() */ /*! @@ -147,7 +147,7 @@ fun.qml: Get back to work, slacker! Without this, a generic "Game is not a type" message would be given. - \sa qmlRegisterUncreatableType + \sa qmlRegisterUncreatableType() */ /*! diff --git a/doc/src/snippets/declarative/gradient.qml b/doc/src/snippets/declarative/gradient.qml index d25352b..7a68233 100644 --- a/doc/src/snippets/declarative/gradient.qml +++ b/doc/src/snippets/declarative/gradient.qml @@ -41,6 +41,7 @@ import Qt 4.7 +//![code] Rectangle { width: 100; height: 100 gradient: Gradient { @@ -49,3 +50,4 @@ Rectangle { GradientStop { position: 1.0; color: "green" } } } +//![code] diff --git a/doc/src/snippets/declarative/texteditor.qml b/doc/src/snippets/declarative/texteditor.qml index 0bd79b5..6735c6c 100644 --- a/doc/src/snippets/declarative/texteditor.qml +++ b/doc/src/snippets/declarative/texteditor.qml @@ -45,7 +45,8 @@ Flickable { id: flick width: 300; height: 200; - contentHeight: edit.height + contentWidth: edit.paintedWidth + contentHeight: edit.paintedHeight clip: true function ensureVisible(r) @@ -62,9 +63,10 @@ Flickable { TextEdit { id: edit - width: parent.width + width: flick.width + height: flick.height focus: true - wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere + wrapMode: TextEdit.Wrap onCursorRectangleChanged: flick.ensureVisible(cursorRectangle) } } diff --git a/doc/src/snippets/declarative/xmlrole.qml b/doc/src/snippets/declarative/xmlrole.qml new file mode 100644 index 0000000..6d04daf --- /dev/null +++ b/doc/src/snippets/declarative/xmlrole.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** 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 QtDeclarative module 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$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + width: 300; height: 200 + +//![0] +XmlListModel { + id: model +//![0] + source: "xmlrole.xml" + +//![1] + // XmlRole queries will be made on <book> elements + query: "/catalogue/book" + + // query the book title + XmlRole { name: "title"; query: "title/string()" } + + // query the book's year + XmlRole { name: "year"; query: "year/number()" } + + // query the book's type (the '@' indicates 'type' is an attribute, not an element) + XmlRole { name: "type"; query: "@type/string()" } + + // query the book's first listed author (note in XPath the first index is 1, not 0) + XmlRole { name: "first_author"; query: "author[1]/string()" } +} +//![1] + +ListView { + width: 300; height: 200 + model: model + delegate: Column { + Text { text: title + " (" + type + ")"; font.bold: true } + Text { text: first_author } + Text { text: year } + } +} + +} diff --git a/doc/src/snippets/declarative/xmlrole.xml b/doc/src/snippets/declarative/xmlrole.xml new file mode 100644 index 0000000..c9f999e --- /dev/null +++ b/doc/src/snippets/declarative/xmlrole.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="iso-8859-1" ?> +<catalogue> + <book type="Hardcover"> + <title>C++ GUI Programming with Qt 4</title> + <year>2006</year> + <author>Jasmin Blanchette</author> + <author>Mark Summerfield</author> + </book> + <book type="Paperback"> + <title>Programming with Qt</title> + <year>2002</year> + <author>Matthias Kalle Dalheimer</author> + </book> + </catalogue> |