From 87679b3499e68957998b98bf13b6d98b3aa8b4c3 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 28 Aug 2012 11:21:19 +1000 Subject: [PATCH] Docs - add missing images and code, clean up sections Includes the removal of concepts/modelviewsdata/localstorage.qdoc since that is a duplicate of the existing Local Storage module docs. Also removes classes from whatsnew.qdoc that are internal. Change-Id: I4170c1797bbec09bb67784b0b2ad67fd990365a8 Reviewed-by: Andrew den Exter --- examples/localstorage/localstorage/hello.qml | 8 +- src/imports/localstorage/plugin.cpp | 14 +- .../doc/src/cppintegration/extending-tutorial.qdoc | 2 +- src/qml/doc/src/modules/cppplugins.qdoc | 10 +- src/qml/doc/src/modules/qmldir.qdoc | 2 +- src/qml/doc/src/qtqml.qdoc | 4 +- src/qml/doc/src/syntax/basics.qdoc | 14 +- src/qml/qml/qqmlextensionplugin.cpp | 12 +- src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp | 2 +- .../images/documents-definetypes-attributes.png | Bin 0 -> 771 bytes .../doc/images/documents-definetypes-simple.png | Bin 0 -> 339 bytes src/quick/doc/images/manual-layout.png | Bin 0 -> 642 bytes src/quick/doc/images/qml-uses-layouts-anchors.png | Bin 0 -> 946 bytes src/quick/doc/images/qml-uses-layouts-direct.png | Bin 0 -> 344 bytes .../doc/images/qml-uses-layouts-positioners.png | Bin 0 -> 471 bytes src/quick/doc/images/qml-uses-layouts.png | Bin 301 -> 0 bytes .../qtqml-syntax-basics-object-declaration.png | Bin 0 -> 339 bytes src/quick/doc/snippets/qml/usecases/layouts.qml | 52 +++++--- .../doc/src/appdevguide/applicationdevelopers.qdoc | 2 +- src/quick/doc/src/appdevguide/porting.qdoc | 2 +- .../doc/src/appdevguide/usecases/layouts.qdoc | 34 ++++-- src/quick/doc/src/concepts/input/topic.qdoc | 58 ++++---- .../src/concepts/modelviewsdata/localstorage.qdoc | 140 -------------------- .../doc/src/concepts/modelviewsdata/topic.qdoc | 2 +- src/quick/doc/src/concepts/positioning/topic.qdoc | 25 ++-- src/quick/doc/src/cppextensionpoints.qdoc | 35 ++++- src/quick/doc/src/qtquick.qdoc | 1 + src/quick/doc/src/whatsnew.qdoc | 4 - src/quick/items/qquickitem.cpp | 16 ++- src/quick/util/qquickimageprovider.cpp | 8 +- 30 files changed, 185 insertions(+), 262 deletions(-) create mode 100644 src/quick/doc/images/documents-definetypes-attributes.png create mode 100644 src/quick/doc/images/documents-definetypes-simple.png create mode 100644 src/quick/doc/images/manual-layout.png create mode 100644 src/quick/doc/images/qml-uses-layouts-anchors.png create mode 100644 src/quick/doc/images/qml-uses-layouts-direct.png create mode 100644 src/quick/doc/images/qml-uses-layouts-positioners.png delete mode 100644 src/quick/doc/images/qml-uses-layouts.png create mode 100644 src/quick/doc/images/qtqml-syntax-basics-object-declaration.png delete mode 100644 src/quick/doc/src/concepts/modelviewsdata/localstorage.qdoc diff --git a/examples/localstorage/localstorage/hello.qml b/examples/localstorage/localstorage/hello.qml index 3496b86..d872379 100644 --- a/examples/localstorage/localstorage/hello.qml +++ b/examples/localstorage/localstorage/hello.qml @@ -39,18 +39,18 @@ ****************************************************************************/ //![0] import QtQuick 2.0 -import QtQuick.LocalStorage 2.0 as LS +import QtQuick.LocalStorage 2.0 Rectangle { - color: "white" width: 200 height: 100 - + Text { text: "?" anchors.horizontalCenter: parent.horizontalCenter + function findGreetings() { - var db = LS.openDatabaseSync("QDeclarativeExampleDB", "1.0", "The Example QML SQL!", 1000000); + var db = LocalStorage.openDatabaseSync("QQmlExampleDB", "1.0", "The Example QML SQL!", 1000000); db.transaction( function(tx) { diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index a16b74a..ab67d2c 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -468,16 +468,16 @@ through the data. \section1 Detailed Description - To use the types in this module, import the module with a namespace and call the - relevant functions using the namespace qualifier: + To use the types in this module, import the module and call the + relevant functions using the \c LocalStorage type: \code - import QtQuick.LocalStorage 2.0 as LS + import QtQuick.LocalStorage 2.0 import QtQuick 2.0 Item { Component.onCompleted: { - var db = LS.openDatabaseSync(...) + var db = LocalStorage.openDatabaseSync(...) } } \endcode @@ -491,19 +491,19 @@ Database connections are automatically closed during Javascript garbage collecti The API can be used from JavaScript functions in your QML: -\snippet qml/sqllocalstorage/hello.qml 0 +\snippet localstorage/localstorage/hello.qml 0 The API conforms to the Synchronous API of the HTML5 Web Database API, \link http://www.w3.org/TR/2009/WD-webdatabase-20091029/ W3C Working Draft 29 October 2009\endlink. -The \l{declarative/sqllocalstorage}{SQL Local Storage example} demonstrates the basics of +The \l{localstorage/localstorage}{SQL Local Storage example} demonstrates the basics of using the Offline Storage API. \section3 Open or create a databaseData \code import QtQuick.LocalStorage 2.0 as LS -db = LS.openDatabaseSync(identifier, version, description, estimated_size, callback(db)) +db = Sql.openDatabaseSync(identifier, version, description, estimated_size, callback(db)) \endcode The above code returns the database identified by \e identifier. If the database does not already exist, it is created, and the function \e callback is called with the database as a parameter. \e description diff --git a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc index 28c310e..8a3b769 100644 --- a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc +++ b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc @@ -456,7 +456,7 @@ In this tutorial, we've shown the basic steps for creating a QML extension: The \l{Integrating QML and C++} documentation shows other useful features that can be added to QML extensions. For example, we -could use \l{Default Property}{default properties} to allow +could use \l{Default Properties}{default properties} to allow slices to be added without using the \c slices property: \code diff --git a/src/qml/doc/src/modules/cppplugins.qdoc b/src/qml/doc/src/modules/cppplugins.qdoc index 887e7cc..2875dd9 100644 --- a/src/qml/doc/src/modules/cppplugins.qdoc +++ b/src/qml/doc/src/modules/cppplugins.qdoc @@ -68,7 +68,7 @@ as a new QML element. It provides the current time through \c hour and \c minute properties. - \snippet examples/qml/cppextensions/plugins/plugin.cpp 0 + \snippet examples/qml/plugins/plugin.cpp 0 \dots To make this type available, we create a plugin class named \c QExampleQmlPlugin @@ -78,7 +78,7 @@ definition to register the plugin with the Qt meta object system using a unique identifier for the plugin. - \snippet examples/qml/cppextensions/plugins/plugin.cpp plugin + \snippet examples/qml/plugins/plugin.cpp plugin The \c TimeModel class receives a \c{1.0} version of this plugin library, as a QML type called \c Time. The Q_ASSERT() macro can ensure the type namespace is @@ -111,15 +111,15 @@ that is built by the project (as shown above in the \c .pro file) so both of these need to be specified in the \c qmldir file: - \quotefile examples/qml/cppextensions/plugins/com/nokia/TimeExample/qmldir + \quotefile examples/qml/plugins/com/nokia/TimeExample/qmldir Once the project is built and installed, the new \c Time component is accessible by any QML component that imports the \c com.nokia.TimeExample module - \snippet examples/qml/cppextensions/plugins/plugins.qml 0 + \snippet examples/qml/plugins/plugins.qml 0 - The full source code is available in the \l {qml/cppextensions/plugins}{plugins example}. + The full source code is available in the \l {qml/plugins}{plugins example}. \section1 Reference diff --git a/src/qml/doc/src/modules/qmldir.qdoc b/src/qml/doc/src/modules/qmldir.qdoc index 9802cd7..4f56b20 100644 --- a/src/qml/doc/src/modules/qmldir.qdoc +++ b/src/qml/doc/src/modules/qmldir.qdoc @@ -247,7 +247,7 @@ version of installed software, since a versioned import \e only imports types for that version, leaving other identifiers available, even if the actual installed version might otherwise provide those identifiers. -See \l{examples/qml/cppextensions/plugins} for an example that uses C++ +See \l{examples/qml/plugins} for an example that uses C++ plugins. diff --git a/src/qml/doc/src/qtqml.qdoc b/src/qml/doc/src/qtqml.qdoc index 8baef1d..029e4ba 100644 --- a/src/qml/doc/src/qtqml.qdoc +++ b/src/qml/doc/src/qtqml.qdoc @@ -39,8 +39,8 @@ developers to extend the QML language with custom types and integrate QML code with JavaScript and C++. The Qt QML module provides both the \c QtQml QML module, which supplies -\l{Qt QML - C++ Classes}{a set of core QML types} for creating QML -applications, and the \c QtQml C++ module, which supplies \l{Qt QML - C++ Classes}{a set of C++ +\l{Qt QML Module - C++ Classes}{a set of core QML types} for creating QML +applications, and the \c QtQml C++ module, which supplies \l{Qt QML Module - C++ Classes}{a set of C++ APIs} for extending QML applications with custom types and integrating C++ implementations with QML applications. diff --git a/src/qml/doc/src/syntax/basics.qdoc b/src/qml/doc/src/syntax/basics.qdoc index abfa6d5..3cca5cb 100644 --- a/src/qml/doc/src/syntax/basics.qdoc +++ b/src/qml/doc/src/syntax/basics.qdoc @@ -83,8 +83,8 @@ Here is a simple object declaration: \qml Rectangle { - width: 200 - height: 200 + width: 100 + height: 100 color: "red" } \endqml @@ -97,8 +97,8 @@ The above object can be loaded by the engine if it is part of a \l{qtqml-documen import QtQuick 2.0 Rectangle { - width: 200 - height: 200 + width: 100 + height: 100 color: "red" } \endqml @@ -110,7 +110,7 @@ When placed into a \c .qml file and loaded by the QML engine, the above code cre \note If an object definition only has a small number of properties, it can be written on a single line like this, with the properties separated by semi-colons: \qml -Rectangle { width: 200; height: 200; color: "red" } +Rectangle { width: 100; height: 100; color: "red" } \endqml Obviously, the \l Rectangle object declared in this example is very simple indeed, as it defines nothing more than a few property values. To create more useful objects, an object declaration may define many other types of attributes: these are discussed in the \l{qtqml-syntax-objectattributes.html}{QML Object Attributes} documentation. Additionally, an object declaration may define child objects, as discussed below. @@ -127,8 +127,8 @@ which in turn contains two \l GradientStop declarations: import QtQuick 2.0 Rectangle { - width: 200 - height: 200 + width: 100 + height: 100 gradient: Gradient { GradientStop { position: 0.0; color: "yellow" } diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp index f75b2bd..5822707 100644 --- a/src/qml/qml/qqmlextensionplugin.cpp +++ b/src/qml/qml/qqmlextensionplugin.cpp @@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE as a new QML element. It provides the current time through \c hour and \c minute properties, like this: - \snippet examples/qml/cppextensions/plugins/plugin.cpp 0 + \snippet examples/qml/plugins/plugin.cpp 0 \dots To make this class available as a QML type, create a plugin that registers @@ -84,9 +84,9 @@ QT_BEGIN_NAMESPACE module will be named \c com.nokia.TimeExample (as defined in the project file further below). - \snippet examples/qml/cppextensions/plugins/plugin.cpp plugin + \snippet examples/qml/plugins/plugin.cpp plugin \codeline - \snippet examples/qml/cppextensions/plugins/plugin.cpp export + \snippet examples/qml/plugins/plugin.cpp export This registers the \c TimeModel class with the 1.0 version of this plugin library, as a QML type called \c Time. The Q_ASSERT statement @@ -110,14 +110,14 @@ QT_BEGIN_NAMESPACE should be bundled with the plugin, so it needs to be specified in the \c qmldir file: - \quotefile examples/qml/cppextensions/plugins/com/nokia/TimeExample/qmldir + \quotefile examples/qml/plugins/com/nokia/TimeExample/qmldir Once the project is built and installed, the new \c Time element can be used by any QML component that imports the \c com.nokia.TimeExample module: - \snippet examples/qml/cppextensions/plugins/plugins.qml 0 + \snippet examples/qml/plugins/plugins.qml 0 - The full source code is available in the \l {qml/cppextensions/plugins}{plugins example}. + The full source code is available in the \l {qml/plugins}{plugins example}. The \l {Writing QML Extensions with C++} tutorial also contains a chapter on creating QML plugins. diff --git a/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp b/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp index 4c31e55..ead6060 100644 --- a/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp +++ b/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp @@ -82,7 +82,7 @@ QT_BEGIN_NAMESPACE The QtQuick 1 version of this class is named QDeclarativeNetworkAccessManagerFactory. - \sa {qml/cppextensions/networkaccessmanagerfactory}{NetworkAccessManagerFactory example} + \sa {qml/networkaccessmanagerfactory}{NetworkAccessManagerFactory example} */ /*! diff --git a/src/quick/doc/images/documents-definetypes-attributes.png b/src/quick/doc/images/documents-definetypes-attributes.png new file mode 100644 index 0000000000000000000000000000000000000000..940c051c5e203b700b852a64a81823760e31d662 GIT binary patch literal 771 zcmeAS@N?(olHy`uVBq!ia0vp^DM0*-gAGWA_dQAnQk(@Ik;M!Q+`=Ht$S`Y;1Oo%p zR!`@ky7DdP{7pac{+*SrqRD!vW6mYadz>88 zC)d!=(kZCoHbKHMi4KfwoBs&kmT>p~V4dU9qhQ!{ghNPqSTff5`yaoN*)xB(JO2mS z&#yDLH}47Pm|n8~ey_pnXU%VtmCroAtoXZnM|J!w!|Mv$9#?E3&SpAit#iyd`7w_-$Ky=3Ky=ZZ_TBO3{Ksw-&-tI7%z3T%c+1ah c|9fuvO_eHNWa=DPfvK9o)78&qol`;+0C+h2fB*mh literal 0 HcmV?d00001 diff --git a/src/quick/doc/images/documents-definetypes-simple.png b/src/quick/doc/images/documents-definetypes-simple.png new file mode 100644 index 0000000000000000000000000000000000000000..7b566a36a7fe9eeac108004a0852d5984043a67e GIT binary patch literal 339 zcmeAS@N?(olHy`uVBq!ia0vp^DImXRNC8S^FKQ|Jw)*B?eDdKbLh*2~7Y>6m3HQ literal 0 HcmV?d00001 diff --git a/src/quick/doc/images/manual-layout.png b/src/quick/doc/images/manual-layout.png new file mode 100644 index 0000000000000000000000000000000000000000..b9351ecbd8895f3527998e304ad5b9b03f966d90 GIT binary patch literal 642 zcmeAS@N?(olHy`uVBq!ia0vp^CqS5k4M?tyST_$yaTa()7Bet#3xhBt!>l2yn184g_IQ#{b~@oZaFDPaOv$Ai!b2X6DSh$`4lB f3{VgVaJ1+%WbkoX1oGAZ6BUD}tDnm{r-UW|`1_0k literal 0 HcmV?d00001 diff --git a/src/quick/doc/images/qml-uses-layouts-anchors.png b/src/quick/doc/images/qml-uses-layouts-anchors.png new file mode 100644 index 0000000000000000000000000000000000000000..769597cf52c48403d2208da895584f16b0284d2f GIT binary patch literal 946 zcmeAS@N?(olHy`uVBq!ia0vp^CxQ3`2OE%dnssymkm4-xh%9Dc;1&j9Muu5)Bp4W& zQ#@T9Ln`LHy=&+f6E1T6;ZBE#4>((Wg(G)#q^K)wDy)ybU3QgctE95w1b7~u|*e)7C%3~Qsb$!XL~&s6qS^y z2(92btRUp!!qn)o;6b7iixNmB(?o|2Ti-GNxqmA@_pbYobzj3@+c|!C_WEB+^IVXm z!R)gxOjCF7ww~yanxF5l5^(d@Eg?=7rN$=z?Fs^%YaCPrz=j<30~(vas?-P9rWk_3PJxE_wKHp@)JXr^vL^OFb4O6}AJF?#Odg5aIwjX)a4sp^Ph&=wucq zAnLXTY6MD0+)*^}Q~)BNN$a8o?%cZv^w#g+zk!As@F+F9z$`BYnE|v;L{DGem1*k! z`WkhJM?o49Zh~0lL9Ae_-AtdT_j}j>R`{?sYwb*xfS+IA7Eg3oT5iobMQr}`GNBc7 z=FOX>5)i2)26YRUxVSjbZ6#KsoFQ@h?g(>+MBNtP3;}!i5vx0gnOV&C1zUFR)D&6) z47KaJ96IlS!Pj*Bxcfwhr~m%N0fYDMU7+4Q)0i5M%7!TjX?(c{^v~+m+CcdqKO%rm zF!-$@v?9m8R!eBbndiXx?P~87_|nCWo1cl%KvfpM-BkiAxBb3jAM5z^ z!wYku_T}RCyYn2Mp0}?P=M1T<{Obi&_Tk@Nj|HE8yjKuf0rJD7|Ap-d5O0UIYf81yX$#U3a|?=!W564~?T&-cybn7Vnh@njaEi4G)&ZX?n0 nfKVBb0Zi&Zs}^oG`^mp}&HIuS?wh9rGa-YgtDnm{r-UW|P{vwZ literal 0 HcmV?d00001 diff --git a/src/quick/doc/images/qml-uses-layouts-direct.png b/src/quick/doc/images/qml-uses-layouts-direct.png new file mode 100644 index 0000000000000000000000000000000000000000..0682da36f82aab6eeb81a4b81936fc0050c47d6f GIT binary patch literal 344 zcmeAS@N?(olHy`uVBq!ia0vp^DImspbFJ^i!5KIB&=}dnP93&T{?--V-DolUOUm+ArxDh5wiKbLh*2~7atf@Mko literal 0 HcmV?d00001 diff --git a/src/quick/doc/images/qml-uses-layouts-positioners.png b/src/quick/doc/images/qml-uses-layouts-positioners.png new file mode 100644 index 0000000000000000000000000000000000000000..ebdd9c58ddf9cff149a41c0e3a62130e688fa054 GIT binary patch literal 471 zcmeAS@N?(olHy`uVBq!ia0y~yVAKJ!Q#sgxhyGR45^s&_F5w+lc4~^!6V0x8tuEanf0OaCX3($f<-AO_pQqob2u<>E6eLX%j(+S zTl>%bHveq1hyV4Cryo8?^lyI5u+M!%1J6MwBNpxx0y+xLBaQRz%$fE4j2}4dDf0V0 Ym2QEqSvPCKficD4>FVdQ&MBb@0A0$GssI20 literal 0 HcmV?d00001 diff --git a/src/quick/doc/images/qml-uses-layouts.png b/src/quick/doc/images/qml-uses-layouts.png deleted file mode 100644 index 3e1162977e0c66a58e747eec79c9bb0e47f98fbd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 301 zcmeAS@N?(olHy`uVBq!ia0y~yU~~ZD2TaUBk(G~Pt^+CNVkgfK4i1jn5B(nixts+a zk;OpeKq=lt#t+*kxd8=v0(?ST85sUE)HA57EBEaktaqI1!g@OzU zJS>j0mYmENVlflqx%oMVd4A%PB4!R2rpCPoL#L?BbbTHxC;;L*D4XRNC8S^FKQ|Jw)*B?eDdKbLh*2~7Y>6m3HQ literal 0 HcmV?d00001 diff --git a/src/quick/doc/snippets/qml/usecases/layouts.qml b/src/quick/doc/snippets/qml/usecases/layouts.qml index 0099cdf..4d1e747 100644 --- a/src/quick/doc/snippets/qml/usecases/layouts.qml +++ b/src/quick/doc/snippets/qml/usecases/layouts.qml @@ -38,18 +38,16 @@ ** ****************************************************************************/ -//![0] +//![import] import QtQuick 2.0 -Item { - width: 320 - height: 480 +//![import] - Rectangle { - color: "#272822" - width: 320 - height: 480 - } +Column { + +//![direct] +Item { + width: 100; height: 100 Rectangle { // Manually positioned at 20,20 @@ -59,32 +57,53 @@ Item { height: 80 color: "red" } +} +//![direct] + +//![anchors] +Item { + width: 200; height: 200 + Rectangle { // Anchored to 20px off the top right corner of the parent anchors.right: parent.right anchors.top: parent.top anchors.margins: 20 // Sets all margins at once + width: 80 height: 80 - color: "blue" + color: "orange" } + Rectangle { - // Anchored to 20px off the top center corner of the parent - // Note the different group property syntax to the previous Rectangle. Both are valid. + // Anchored to 20px off the top center corner of the parent. + // Notice the different group property syntax for 'anchors' compared to + // the previous Rectangle. Both are valid. anchors { horizontalCenter: parent.horizontalCenter; top: parent.top; topMargin: 20 } + width: 80 height: 80 color: "green" } +} +//![anchors] - Row { // Lays the Rectangles out in a line - x: 20 - y: 120 +//![positioners] +Item { + width: 300; height: 100 + + Row { // The "Row" type lays out its child items in a horizontal line spacing: 20 // Places 20px of space between items + Rectangle { width: 80; height: 80; color: "red" } Rectangle { width: 80; height: 80; color: "green" } Rectangle { width: 80; height: 80; color: "blue" } } +} +//![positioners] + +Item { + width: 300; height: 400 Rectangle { id: middleRect @@ -119,4 +138,5 @@ Item { color: "blue" } } -//![0] + +} diff --git a/src/quick/doc/src/appdevguide/applicationdevelopers.qdoc b/src/quick/doc/src/appdevguide/applicationdevelopers.qdoc index 40e5be8..7c3db08 100644 --- a/src/quick/doc/src/appdevguide/applicationdevelopers.qdoc +++ b/src/quick/doc/src/appdevguide/applicationdevelopers.qdoc @@ -110,7 +110,7 @@ animated and visually appealing applications. QML offers a highly readable, declarative, JSON-like syntax with support for imperative JavaScript expressions combined with dynamic property bindings. -The QML language and engine infrastructure is provided by the Qt QML module. +The QML language and engine infrastructure is provided by the \l {Qt QML} module. For in-depth information about the QML language, please see the \l{Qt QML} module documentation. diff --git a/src/quick/doc/src/appdevguide/porting.qdoc b/src/quick/doc/src/appdevguide/porting.qdoc index 35860a8..5b50e2e 100644 --- a/src/quick/doc/src/appdevguide/porting.qdoc +++ b/src/quick/doc/src/appdevguide/porting.qdoc @@ -67,7 +67,7 @@ Qt.inputMethod.hide() to show and hide the virtual keyboard. XmlListModel and XmlRole types must import \e {QtQuick.XmlListModel} instead. \li The local storage API that enables SQL support has been moved from the \l {QML Global Object} into a \c QtQuick.LocalStorage singleton type. Any code that requires the local storage API must import -\e {QtQuick.LocalStorage} instead. See the \l \l{QtQuick.LocalStorage 2}{QtQuick.LocalStorage} documentation +\e {QtQuick.LocalStorage} instead. See the \l {QtQuick.LocalStorage 2}{QtQuick.LocalStorage} documentation for examples. \li The \c LayoutItem type has been removed from the \c QtQuick module as it was specific to the Graphics View framework backend used in QtQuick 1. diff --git a/src/quick/doc/src/appdevguide/usecases/layouts.qdoc b/src/quick/doc/src/appdevguide/usecases/layouts.qdoc index cf059e9..2b68938 100644 --- a/src/quick/doc/src/appdevguide/usecases/layouts.qdoc +++ b/src/quick/doc/src/appdevguide/usecases/layouts.qdoc @@ -29,39 +29,51 @@ \title Use Case - Layouts In QML \brief Example of how to create layouts for visual elements in a QML application -There are several ways to position items in QML, including simple property bindings. +There are several ways to position items in QML. + +Below is a brief overview. For more details, see \l {Important Concepts In Qt Quick - Positioning}. \section1 Manual Positioning -Items can be placed at specific x,y coordinates on the screen by setting their x,y properties. This will setup their -position relative to the top left corner of their parent, for more detail see \c {Visual Canvas}. +Items can be placed at specific x,y coordinates on the screen by setting their x,y properties. This will +setup their position relative to the top left corner of their parent, according to the +\l {Concepts - Visual Coordinates in Qt Quick}{visual coordinate system} rules. -Combined with using bindings instead of constant valudes for these properties, relative positioning is also easily +Combined with using \l{Property Binding}{bindings} instead of constant valudes for these properties, relative positioning is also easily accomplished by setting the x and y coordinates to the appropriate bindings. +\snippet qml/usecases/layouts.qml import \snippet qml/usecases/layouts.qml direct +\image qml-uses-layouts-direct.png + + \section1 Anchors -The \c Item type provides the abilitiy to anchor to other Item types. There are six anchor lines for each item: left, -right, vertical center, top, bottom and horizontal center. The three vertical anchor lines can be anchored to any of +The \c Item type provides the abilitiy to anchor to other \l Item types. There are six anchor lines for each item: \e left, +\e right, \e{vertical center}, \e top, \e bottom and \e{horizontal center}. The three vertical anchor lines can be anchored to any of the three vertical anchor lines of another item, and the three horizontal anchor lines can be anchored to the horizontal anchor lines of another item. -For full details, see the documentation of the \l{Item::anchors}{anchors property}. +For full details, see \l {Positioning with Anchors} and the documentation of the \l{Item::anchors.top}{anchors property}. +\snippet qml/usecases/layouts.qml import \snippet qml/usecases/layouts.qml anchors +\image qml-uses-layouts-anchors.png + + \section1 Positioners -For the common case of wanting to position a set of elements in a regular pattern, QtQuick provides some Positioner -types. Items placed in a positioner are automatically positioned in some way, for example a Row positions items to be +For the common case of wanting to position a set of elements in a regular pattern, QtQuick provides some positioner +types. Items placed in a positioner are automatically positioned in some way; for example, a \l Row positions items to be horizontally adjacent (forming a row). -For full details see the documentation for \l{qtquick-qmltypereference.html#positioning}{the positioner types}. +For full details see \l {Item Layouts} and the documentation for \l{qtquick-qmltypereference.html#positioning}{the positioner types}. +\snippet qml/usecases/layouts.qml import \snippet qml/usecases/layouts.qml positioners -\image qml-uses-layouts.png +\image qml-uses-layouts-positioners.png */ diff --git a/src/quick/doc/src/concepts/input/topic.qdoc b/src/quick/doc/src/concepts/input/topic.qdoc index 94c29e1..5079e06 100644 --- a/src/quick/doc/src/concepts/input/topic.qdoc +++ b/src/quick/doc/src/concepts/input/topic.qdoc @@ -47,34 +47,11 @@ and thus touch events are supported in various visual object types, from in the \l{MouseArea} type (which will be documented thoroughly in a proceeding section). -\section1 Motion Gestures - -Detecting gestures with an accelerometer, or through camera-based gesture -recognition, can allow users to interact with an application without requiring -their full and undevided attention. It can also provide a more interactive -and engaging experience. - -Qt Quick itself does not offer first-class support for motion gestures, however -another QML add-on module which provides support for gestures, which uses -Qt Quick and integrates with Qt Quick's visual canvas does exist. See the -Qt Sensors module documentation for more information on the topic. - -\section1 Keyboard - -Supporting input from a keyboard is a vital component of the user-interface of -many applications. - -XXX TODO: generic keypress event handling documentation? - -Qt Quick also provides visual object types which automatically receive keyboard -events and key-presses, and displays the appropriate text. Please see the -documentation about \l{qtquick-input-textinput.html}{text input} for -in-depth information on the topic. \section1 Mouse -The computer mouse is still a very important vector for user-input. Detecting -and reacting to clicks and presses according to their position is a fundamental +Mouse input is another important user input for user interfaces. Detecting +and reacting to clicks and presses according to the mouse cursor position is a fundamental concept in user-interface design. Qt Quick provides the MouseArea visual object type which automatically receives @@ -83,13 +60,34 @@ create custom user-interface objects to handle mouse input. Please see the documentation about \l{qtquick-input-mouseevents.html} {mouse events in Qt Quick} for more information on the topic. -\section1 Focus -Most user-interfaces have multiple visual objects, but usually only one object -has focus (that is, receives key-press events) at any time. Qt Quick has -support for complex focus specification. See the documentation about -\l{qtquick-input-focus.html}{keyboard focus in Qt Quick} for more +\section1 Keyboard Input and Keyboard Focus + +Supporting input from a keyboard is a vital component of the user interface of +many applications. + +Any visual item can receive keyboard input through the \l Keys attached type. +Additionally, the issue of \e {keyboard focus} arises when multiple items +are required to receive key events, as these events must be passed to the +correct item. See the documentation about \l{Keyboard focus in Qt Quick} for more information on this topic. +Qt Quick also provides visual text items which automatically receive keyboard +events and key-presses, and displays the appropriate text. See the +documentation about \l{qtquick-input-textinput.html}{text input} for +in-depth information on the topic. + + +\section1 Device Motion Gestures + +Detecting device gestures with an accelerometer, or through camera-based gesture +recognition, can allow users to interact with an application without requiring +their full and undevided attention. It can also provide a more interactive +and engaging experience. + +Qt Quick itself does not offer first-class support for physical device motion gestures; +however, the \l{Qt Sensors} module provides QML types with support for such gestures. +See the \l{Qt Sensors} module documentation for more information on the topic. + */ diff --git a/src/quick/doc/src/concepts/modelviewsdata/localstorage.qdoc b/src/quick/doc/src/concepts/modelviewsdata/localstorage.qdoc deleted file mode 100644 index 8dc264c..0000000 --- a/src/quick/doc/src/concepts/modelviewsdata/localstorage.qdoc +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** GNU Free Documentation License -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms -** and conditions contained in a signed written agreement between you -** and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! -\page qtquick-modelviewsdata-localstorage.html -\title Local Storage -\brief SQL storage for Qt Quick - -Qt Quick includes a simple API to allow saving data to an SQL database. The -QtQuick.LocalStorage module provides a JavaScript interface to SQL which may be -accessed from QML documents. When imported, the module may be namespaced for -developer convenience. - -Import QtQuick.LocalStorage module from QML: -\code -//sql.qml - -import QtQuick.LocalStorage 2.0 as Sql -\endcode - - -Import QtQuick.LocalStorage module from JavaScript: -\code -//sql.js -.import QtQuick.LocalStorage 2.0 as Sql -\endcode - -Note, importing a module from JavaScript is different from importing from QML. -The \l{JavaScript Code} article contains detailed information on importing in JavaScript code. - - -\section2 Database API - -The \c openDatabaseSync() and related functions -provide the ability to access local storage in an SQL database. - -These databases are user-specific and QML-specific, but accessible to all QML applications. -They are stored in the \c Databases subdirectory -of QQmlEngine::offlineStoragePath(), currently as SQLite databases. - -Database connections are automatically closed during Javascript garbage collection. - -The API can be used from JavaScript functions in your QML: - -\snippet examples/localstorage/hello.qml 0 - -The API conforms to the Synchronous API of the HTML5 Web Database API, -\link http://www.w3.org/TR/2009/WD-webdatabase-20091029/ W3C Working Draft 29 October 2009\endlink. - -The \l{examples/localstorage}{SQL Local Storage example} demonstrates the basics of -using the Local Storage API. - -\section3 db = openDatabaseSync(identifier, version, description, estimated_size, callback(db)) - -Returns the database identified by \e identifier. If the database does not already exist, it -is created, and the function \e callback is called with the database as a parameter. \e description -and \e estimated_size are written to the INI file (described below), but are otherwise currently -unused. - -May throw exception with code property SQLException.DATABASE_ERR, or SQLException.VERSION_ERR. - -When a database is first created, an INI file is also created specifying its characteristics: - -\table -\header \li \b {Key} \li \b {Value} -\row \li Name \li The name of the database passed to \c openDatabase() -\row \li Version \li The version of the database passed to \c openDatabase() -\row \li Description \li The description of the database passed to \c openDatabase() -\row \li EstimatedSize \li The estimated size (in bytes) of the database passed to \c openDatabase() -\row \li Driver \li Currently "QSQLITE" -\endtable - -This data can be used by application tools. - -\section3 db.changeVersion(from, to, callback(tx)) - -This method allows you to perform a \e{Scheme Upgrade}. - -If the current version of \e db is not \e from, then an exception is thrown. - -Otherwise, a database transaction is created and passed to \e callback. In this function, -you can call \e executeSql on \e tx to upgrade the database. - -May throw exception with code property SQLException.DATABASE_ERR or SQLException.UNKNOWN_ERR. - -\section3 db.transaction(callback(tx)) - -This method creates a read/write transaction and passed to \e callback. In this function, -you can call \e executeSql on \e tx to read and modify the database. - -If the callback throws exceptions, the transaction is rolled back. - -\section3 db.readTransaction(callback(tx)) - -This method creates a read-only transaction and passed to \e callback. In this function, -you can call \e executeSql on \e tx to read the database (with SELECT statements). - -\section3 results = tx.executeSql(statement, values) - -This method executes a SQL \e statement, binding the list of \e values to SQL positional parameters ("?"). - -It returns a results object, with the following properties: - -\table -\header \li \b {Type} \li \b {Property} \li \b {Value} \li \b {Applicability} -\row \li int \li rows.length \li The number of rows in the result \li SELECT -\row \li var \li rows.item(i) \li Function that returns row \e i of the result \li SELECT -\row \li int \li rowsAffected \li The number of rows affected by a modification \li UPDATE, DELETE -\row \li string \li insertId \li The id of the row inserted \li INSERT -\endtable - -May throw exception with code property SQLException.DATABASE_ERR, SQLException.SYNTAX_ERR, or SQLException.UNKNOWN_ERR. - - - -*/ diff --git a/src/quick/doc/src/concepts/modelviewsdata/topic.qdoc b/src/quick/doc/src/concepts/modelviewsdata/topic.qdoc index f405a49..88ed7b5 100644 --- a/src/quick/doc/src/concepts/modelviewsdata/topic.qdoc +++ b/src/quick/doc/src/concepts/modelviewsdata/topic.qdoc @@ -49,7 +49,7 @@ see the page titled \l{qtquick-modelviewsdata-modelview.html} Databases are commonly used to store information in applications. Qt Quick provides simplified access to relational databases via the -\l{qtquick-modelviewsdata-localstorage.html}{Qt Quick local storage module}. +\l{QtQuick.LocalStorage 2}{Qt Quick local storage module}. */ diff --git a/src/quick/doc/src/concepts/positioning/topic.qdoc b/src/quick/doc/src/concepts/positioning/topic.qdoc index 6c44e66..17c7e15 100644 --- a/src/quick/doc/src/concepts/positioning/topic.qdoc +++ b/src/quick/doc/src/concepts/positioning/topic.qdoc @@ -54,9 +54,9 @@ In Qt Quick, every visual object is positioned within the \l{qtquick-visual-coordinates.html}{coordinate system} provided by the Qt Quick visual canvas. As described in that document, the x and y coordinates of a visual object are relative to those of its visual -parent, with the top-left corner have the value [0, 0]. +parent, with the top-left corner having the coordinate (0, 0). -Thus, the following example will display three rectangles positioned manually: +Thus, the following example will display two rectangles positioned manually: \table \header @@ -68,28 +68,25 @@ Thus, the following example will display three rectangles positioned manually: \qml import QtQuick 2.0 - Rectangle { - id: r1 - x: 0 - y: 0 + Item { width: 200 height: 200 Rectangle { - id: r2 - x: 0 - y: 100 + x: 50 + y: 50 width: 100 height: 100 - } + color: "green" + } - Rectangle { - id: r3 + Rectangle { x: 100 y: 100 width: 50 - height: 100 - } + height: 50 + color: "yellow" + } } \endqml \li diff --git a/src/quick/doc/src/cppextensionpoints.qdoc b/src/quick/doc/src/cppextensionpoints.qdoc index 953d804..efda628 100644 --- a/src/quick/doc/src/cppextensionpoints.qdoc +++ b/src/quick/doc/src/cppextensionpoints.qdoc @@ -30,23 +30,48 @@ \title C++ Extension Points Provided By Qt Quick \brief Description of the C++ extension points provided by the Qt Quick module -// XXX TODO: should this be a topic page? Are each of the sections below big enough to require their own page? +All QML applications can be extended from C++ in order to use additional +functionality implemented in C++ code or to provide a C++ based QML plugin. +This topic of extending QML from C++ is covered in the \l {Integrating QML and C++} +documentation. -Qt Quick provides several extension and integration points for C++ developers. -In particular, it allows C++ developers to create and register custom +Additionally, the Qt Quick module provides several extension and integration points for C++ +developers, specific to this module. In particular, it allows C++ developers to create and register custom QQuickItem-derived types which can be rendered by Qt Quick. It also provides several scene graph-related classes which allow developers to define their own rendering primitives. + \section1 User-Defined QQuickItem-Derived Types While the Qt Quick module already provides a rich library of visual item types for use in a QML application, some developers may wish to define their own -item-derived types in C++ and expose them to the QML type system. +item-derived types in C++ and expose them to the QML type system. The easiest +way to do this is to subclass QQuickItem, which is the base type +for all visual types in the Qt Quick module. See the QQuickItem documentation +for more details. + \section1 Scene Graph-Related Classes As an OpenGL-based scene graph, the scene graph in Qt Quick uses nodes which -may be geometries or textures. +may be geometries or textures. The \l {Qt Quick Module - C++ Classes}{Qt Quick C++ API} +provides various classes to enable custom nodes to be created in C++ to be +used with the scene graph framework. + +See the \l {Qt Quick Scene Graph} documentation for details. + + +\section1 Pixmap and Threaded Image Support + +While the QML engine allows QML application to load images from filesystem or +network resources, some applications may require the additional option of +loading images from C++ based processes. This can be implemented through the +QQuickImageProvider class, which provides support for pixmap loading and +threaded image requests for QML applications. Any QML application that +requests an image through the special "image:" URL scheme will be directed +to an appropriate image provider to load the image. + +For more information, see the QQuickImageProvider documentation. */ diff --git a/src/quick/doc/src/qtquick.qdoc b/src/quick/doc/src/qtquick.qdoc index af978a4..e108048 100644 --- a/src/quick/doc/src/qtquick.qdoc +++ b/src/quick/doc/src/qtquick.qdoc @@ -102,6 +102,7 @@ To find out more about using the QML language, see the \l{Qt QML Module Document \list \li \l{qtquick-cppextensionpoints.html#user-defined-qquickitem-derived-types}{Creating User-Defined QQuickItem-Derived Types} \li \l{qtquick-cppextensionpoints.html#scene-graph-related-classes}{Scene Graph-Related Classes} + \li \l{qtquick-cppextensionpoints.html#pixmap-and-threaded-image-support}{Pixmap and Threaded Image Support} \endlist \endlist diff --git a/src/quick/doc/src/whatsnew.qdoc b/src/quick/doc/src/whatsnew.qdoc index a182009..d2f45cf 100644 --- a/src/quick/doc/src/whatsnew.qdoc +++ b/src/quick/doc/src/whatsnew.qdoc @@ -62,9 +62,7 @@ Custom rendering can be performed on the scenegraph using the following new clas \li QSGGeometryNode \li QSGClipNode \li QSGTransformNode -\li QSGRootNode \li QSGOpacityNode -\li QSGNodeVisitor \li QSGFlatColorMaterial \li QSGSimpleRectNode \li QSGSimpleTextureNode @@ -176,8 +174,6 @@ relative to its start. \li New \c getText() method returns the text located between specified start and end indexes. Additionally TextEdit has a \l{TextEdit::}{getFormattedText()} method that returns the formatted text. - \li \c openSoftwareInputPanel() and \c closeSoftwareInputPanel() methods have been removed. Use - \c Qt.application.inputMethod.show() and \c Qt.application.inputMethod.hide() instead. \endlist \li \l Text only: \list diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 3d55f52..1bea8a8 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -1689,6 +1689,11 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus) */ /*! + \class QQuickItem::ItemChangeData + \internal +*/ + +/*! \enum QQuickItem::TransformOrigin Controls the point about which simple transforms like scale apply. @@ -3803,7 +3808,7 @@ QQmlListProperty QQuickItemPrivate::states() See \l{Qt Quick States} and \l{Animation and Transitions in Qt Quick} for more details on using states and transitions. - \sa transitions + \sa states */ /*! \property QQuickItem::transitions @@ -3871,6 +3876,9 @@ void QQuickItem::setState(const QString &state) \property QQuickItem::transform \internal */ +/*! + \internal + */ QQmlListProperty QQuickItem::transform() { return QQmlListProperty(this, 0, QQuickItemPrivate::transform_append, @@ -6263,6 +6271,12 @@ void QQuickItem::setKeepTouchGrab(bool keep) } /*! + \qmlmethod object QtQuick2::Item::contains(point point) + + Returns true if this item contains \a point, which is in local coordinates; + returns false otherwise. + */ +/*! Returns true if this item contains \a point, which is in local coordinates; returns false otherwise. diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp index 798af57..49ac80d 100644 --- a/src/quick/util/qquickimageprovider.cpp +++ b/src/quick/util/qquickimageprovider.cpp @@ -154,7 +154,7 @@ QImage QQuickTextureFactory::image() const an image provider named "colors", and the images to be loaded are "yellow" and "red", respectively: - \snippet examples/qml/cppextensions/imageprovider/imageprovider-example.qml 0 + \snippet examples/qml/imageprovider/imageprovider-example.qml 0 When these images are loaded by QML, it looks for a matching image provider and calls its requestImage() or requestPixmap() method (depending on its @@ -165,9 +165,9 @@ QImage QQuickTextureFactory::image() const requested by the above QML. This implementation dynamically generates QPixmap images that are filled with the requested color: - \snippet examples/qml/cppextensions/imageprovider/imageprovider.cpp 0 + \snippet examples/qml/imageprovider/imageprovider.cpp 0 \codeline - \snippet examples/qml/cppextensions/imageprovider/imageprovider.cpp 1 + \snippet examples/qml/imageprovider/imageprovider.cpp 1 To make this provider accessible to QML, it is registered with the QML engine with a "colors" identifier: @@ -189,7 +189,7 @@ QImage QQuickTextureFactory::image() const \image imageprovider.png A complete example is available in Qt's - \l {qml/cppextensions/imageprovider}{examples/qml/cppextensions/imageprovider} + \l {qml/imageprovider}{examples/qml/imageprovider} directory. Note the example registers the provider via a \l{QQmlExtensionPlugin}{plugin} instead of registering it in the application \c main() function as shown above. -- 1.7.2.5