summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-10 08:58:00 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-10 08:58:00 (GMT)
commit9a05223ea9a6ee0dbaac256607be201ea08e6fb6 (patch)
tree54e5407758a18954bdaf64146b8d3ad8532b9297 /doc
parentac27c8ad39a9646a9e509ba7a58f75eeae10bb6e (diff)
parentbfc6a32c2a203766a6debdf19a265a4f0e198403 (diff)
downloadQt-9a05223ea9a6ee0dbaac256607be201ea08e6fb6.zip
Qt-9a05223ea9a6ee0dbaac256607be201ea08e6fb6.tar.gz
Qt-9a05223ea9a6ee0dbaac256607be201ea08e6fb6.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: (119 commits) Add Mac OS X bundle description for qml runtime Cleanup Disallow writes to read-only value type properties Allow undefined to be assigned to QVariant properties Add a Qt.isQtObject() method Fix crash in QML library imports Remove QT_VERSION checks in QML List properties aren't read-only Small doc fix. Make sure WorkerScript thread is stopped on deletion. This also fixes Release ListModel's worker agent on deletion. Doc fixes Fix example Example code style improvements Enable other wrapping modes. TextEdit::wrap changed to TextEdit::wrapMode enumeration Remove use of obsolete "Script" element. unwarn Replace "var" with "variant" in tests Fix test after deletion of GraphicsObjectContainer. ...
Diffstat (limited to 'doc')
-rw-r--r--doc/src/declarative/advtutorial.qdoc26
-rw-r--r--doc/src/declarative/dynamicobjects.qdoc18
-rw-r--r--doc/src/declarative/elements.qdoc10
-rw-r--r--doc/src/declarative/globalobject.qdoc5
-rw-r--r--doc/src/declarative/javascriptblocks.qdoc2
-rw-r--r--doc/src/declarative/modules.qdoc39
-rw-r--r--doc/src/declarative/network.qdoc1
-rw-r--r--doc/src/declarative/qdeclarativedocument.qdoc10
-rw-r--r--doc/src/declarative/qdeclarativei18n.qdoc2
-rw-r--r--doc/src/declarative/qdeclarativemodels.qdoc24
-rw-r--r--doc/src/declarative/qtbinding.qdoc10
-rw-r--r--doc/src/declarative/scope.qdoc10
-rw-r--r--doc/src/deployment/qt-conf.qdoc1
-rw-r--r--doc/src/snippets/declarative/listview/highlight.qml2
14 files changed, 90 insertions, 70 deletions
diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc
index 598f47b..4d3bfa8 100644
--- a/doc/src/declarative/advtutorial.qdoc
+++ b/doc/src/declarative/advtutorial.qdoc
@@ -160,18 +160,20 @@ we cannot use \l Repeater to define the blocks. Instead, we will
create the blocks in JavaScript.
Here is the JavaScript code for generating the blocks, contained in a new
-file, \c samegame.js:
+file, \c samegame.js. The code is explained below.
\snippet declarative/tutorials/samegame/samegame2/samegame.js 0
-The main function here is \c initBoard(). It creates an array to store all the game
-blocks, then calls \c createBlock() to create enough blocks to fill the game canvas.
+The \c startNewGame() function deletes the blocks created in the previous game and
+calculates the number of rows and columns of blocks required to fill the game window for the new game.
+Then, it creates an array to store all the game
+blocks, and calls \c createBlock() to create enough blocks to fill the game window.
-The \c createBlock() function creates a block using the \c Block.qml file
+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 {createComponent(url file)} is called to generate an element from \c Block.qml.
+\o \l {createComponent(url file)}{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.
(If a component is loaded remotely - over HTTP for example - then we would have to wait for the
component to finish loading before calling \c createObject()).
@@ -193,13 +195,13 @@ the JavaScript file as a \l{Modules#QML Modules}{module}:
\snippet declarative/tutorials/samegame/samegame2/samegame.qml 2
This allows us to refer to any functions within \c samegame.js using "SameGame"
-as a prefix: for example, \c SameGame.initBoard() or \c SameGame.createBlock().
-This means we can now connect the New Game button's \c onClicked handler to the \c initBoard()
+as a prefix: for example, \c SameGame.startNewGame() or \c SameGame.createBlock().
+This means we can now connect the New Game button's \c onClicked handler to the \c startNewGame()
function, like this:
\snippet declarative/tutorials/samegame/samegame2/samegame.qml 1
-So, when you click the New Game button, \c initBoard() is called and generates a field of blocks, like this:
+So, when you click the New Game button, \c startNewGame() is called and generates a field of blocks, like this:
\image declarative-adv-tutorial2.png
@@ -247,7 +249,7 @@ To make it easier for the JavaScript code to interface with the QML elements, we
The \c gameCanvas item is the exact size of the board, and has a \c score property and a \l MouseArea for input.
The blocks are now created as its children, and its dimensions are used to determine the board size so that
the application scales to the available screen size.
-Since its size is bound to a multiple of \c tileSize, \c tileSize needs to be moved out of \c samegame.js and into \c samegame.qml as a QML property.
+Since its size is bound to a multiple of \c blockSize, \c blockSize needs to be moved out of \c samegame.js and into \c samegame.qml as a QML property.
Note that it can still be accessed from the script.
The \l MouseArea simply calls \c{handleClick()} in \c samegame.js, which determines whether the player's click should cause any blocks to be removed, and updates \c gameCanvas.score with the current score if necessary. Here is the \c handleClick() function:
@@ -258,7 +260,7 @@ Note that if \c score was a global variable in the \c{samegame.js} file you woul
\section3 Updating the score
-When the player clicks a block and triggers \c handleClick(), \c handleClick() also calls victoryCheck() to update the score and to check whether the player has completed the game. Here is the \c victoryCheck() code:
+When the player clicks a block and triggers \c handleClick(), \c handleClick() also calls \c victoryCheck() to update the score and to check whether the player has completed the game. Here is the \c victoryCheck() code:
\snippet declarative/tutorials/samegame/samegame3/samegame.js 2
@@ -287,7 +289,7 @@ Here is a screenshot of what has been accomplished so far:
\image declarative-adv-tutorial3.png
-Here is the QML code as it is now in \c samegame.qml:
+This is what \c samegame.qml looks like now:
\snippet declarative/tutorials/samegame/samegame3/samegame.qml 0
@@ -439,7 +441,7 @@ By following this tutorial you've seen how you can write a fully functional appl
\o Build your application with \l {{QML Elements}}{QML elements}
\o Add application logic \l{Integrating JavaScript}{with JavaScript code}
\o Add animations with \l {Behavior}{Behaviors} and \l{QML States}{states}
-\o Store persistent application data through online and offline methods
+\o Store persistent application data using the \l{Offline Storage API} or \l XMLHttpRequest
\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
diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc
index b2e3f90..4cb5198 100644
--- a/doc/src/declarative/dynamicobjects.qdoc
+++ b/doc/src/declarative/dynamicobjects.qdoc
@@ -62,15 +62,11 @@ item which you want to manage dynamic instances of, and creating an item from
a string of QML is intended for when the QML itself is generated at runtime.
If you have a component specified in a QML file, you can dynamically load it with
-the createComponent function on the \l{QML Global Object}.
+the \l {createComponent(url file)}{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.
-You can also create a component by placing your QML inside a Component element.
-Referencing that component element by id will be the same as referencing the variable
-which you save the result of createComponent into.
-
-Once you have a component you can use its createObject method to create an instance of
+Once you have a component you can use its \c createObject() method to create an instance of
the component. Example QML script is below. Remember that QML files that might be loaded
over the network cannot be expected to be ready immediately.
\code
@@ -116,13 +112,13 @@ the component. Example QML script is below. Remember that QML files that might b
After creating the item, remember to set its parent to an item within the scene.
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 createComponent is executed.
+be relative to the file where \c createComponent() is executed.
If the QML does not exist until runtime, you can create a QML item from
-a string of QML using the createQmlObject function, as in the following example:
+a string of QML using the \l{createQmlObject(string qml, object parent, string filepath)}{createQmlObject()} function, as in the following example:
\code
- newObject = createQmlObject('import Qt 4.6; Rectangle { color: "red"; width: 20; height: 20 }',
+ newObject = createQmlObject('import Qt 4.7; Rectangle { color: "red"; width: 20; height: 20 }',
targetItem, "dynamicSnippet1");
\endcode
The first argument is the string of QML to create. Just like in a new file, you will need to
@@ -139,9 +135,9 @@ will not have an id in QML.
A restriction which you need to manage with dynamically created items,
is that the creation context must outlive the
-created item. The creation context is the QDeclarativeContext in which createComponent
+created item. The creation context is the QDeclarativeContext in which \c createComponent()
was called, or the context in which the Component element, or the item used as the
-second argument to createQmlObject, was specified. If the creation
+second argument to \c createQmlObject(), was specified. If the creation
context is destroyed before the dynamic item is, then bindings in the dynamic item will
fail to work.
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index 1bb739d..4946346 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -88,11 +88,17 @@ The following table lists the QML elements provided by the Qt Declarative module
\o
\list
\o \l Binding
-\o \l ListModel, \l ListElement
+\o \l ListModel
+\list
+\o \l ListElement
+\endlist
\o \l VisualItemModel
\o \l VisualDataModel
\o \l Package
-\o \l XmlListModel and XmlRole
+\o \l XmlListModel
+\list
+\o \l XmlRole
+\endlist
\endlist
\o
diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc
index 231e75a..97f5d91 100644
--- a/doc/src/declarative/globalobject.qdoc
+++ b/doc/src/declarative/globalobject.qdoc
@@ -203,6 +203,9 @@ This function causes the QML engine to emit the quit signal, which in
This function returns \c url resolved relative to the URL of the
caller.
+\section3 Qt.isQtObject(object)
+Returns true if \c object is a valid reference to a Qt or QML object, otherwise false.
+
\section1 Dynamic Object Creation
The following functions on the global object allow you to dynamically create QML
items from files or strings. See \l{Dynamic Object Management} for an overview
@@ -266,7 +269,7 @@ of their use.
Example (where targetItem is the id of an existing QML item):
\code
- newObject = createQmlObject('import Qt 4.6; Rectangle {color: "red"; width: 20; height: 20}',
+ newObject = createQmlObject('import Qt 4.7; Rectangle {color: "red"; width: 20; height: 20}',
targetItem, "dynamicSnippet1");
\endcode
diff --git a/doc/src/declarative/javascriptblocks.qdoc b/doc/src/declarative/javascriptblocks.qdoc
index c198295..3544bc9 100644
--- a/doc/src/declarative/javascriptblocks.qdoc
+++ b/doc/src/declarative/javascriptblocks.qdoc
@@ -163,7 +163,7 @@ component instance) "startup". While it is tempting to just include the startup
script as \e {global code} in an external script file, this can have severe limitations
as the QML environment may not have been fully established. For example, some objects
might not have been created or some \l {Property Binding}s may not have been run.
-\l {QML Script Restrictions} covers the exact limitations of global script code.
+\l {QML JavaScript Restrictions} covers the exact limitations of global script code.
The QML \l Component element provides an \e attached \c onCompleted property that
can be used to trigger the execution of script code at startup after the
diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc
index d476d6f..0c69930 100644
--- a/doc/src/declarative/modules.qdoc
+++ b/doc/src/declarative/modules.qdoc
@@ -86,7 +86,7 @@ The second exception is explained in more detail in the section below on Namespa
\section2 The Import Path
Installed modules are searched for on the import path.
-The \c -L option to the \l {Qt Declarative UI Runtime}{qml} runtime adds paths to the import path.
+The \c -I option to the \l {Qt Declarative UI Runtime}{qml} runtime adds paths to the import path.
From C++, the path is available via \l QDeclarativeEngine::importPathList() and can be prepended to
using \l QDeclarativeEngine::addImportPath().
@@ -114,19 +114,7 @@ Installed files do not need to import the module of which they are a part, as th
to the other QML files in the module as relative (local) files, but
if the module is imported from a remote location, those files must nevertheless be listed in
the \c qmldir file. Types which you do not wish to export to users of your module
-may be marked with the \c internal keyword:
-
-\code
-internal <TypeName> <File>
-\endcode
-
-\c plugin <Name> [<Path>] lines are used to add \l{QDeclarativeExtensionPlugin}{QML C++ plugins}
-to the module. <Name> is the
-name of the library. <Path> is an optional argument specifying the full path to the directory
-containing the plugin file; if it is omitted then the directory is assumed to be the same as
-the directory of the \c qmldir file. Note that <Name> is not usually the same as the file name
-of the plugin binary, which is platform dependent; e.g. the library MyAppTypes would produce
-a libMyAppTypes.so on Linux and MyAppTypes.dll on Windows.
+may be marked with the \c internal keyword: \c internal <TypeName> <File>.
The same type can be provided by different files in different versions, in which
case later earlier versions (eg. 1.2) must precede earlier versions (eg. 1.0),
@@ -141,6 +129,23 @@ of installed software, since a versioned import \e only imports types for that v
leaving other identifiers available, even if the actual installed version might otherwise
provide those identifiers.
+\c plugin <Name> [<Path>] lines are used to add \l{QDeclarativeExtensionPlugin}{QML C++ plugins}
+to the module.
+
+<Name> is the name of the library. It is usually not the same as the file name
+of the plugin binary, which is platform dependent; e.g. the library MyAppTypes would produce
+a libMyAppTypes.so on Linux and MyAppTypes.dll on Windows.
+By default the engine searches for the plugin library in the directory containing the \c qmldir
+file. The \c -P option to the \l {Qt Declarative UI Runtime}{qml} runtime adds paths to the
+plugin search path.
+From C++, the path is available via \l QDeclarativeEngine::pluginPathList() and can be prepended to
+using \l QDeclarativeEngine::addPluginPath().
+
+<Path> is an optional argument specifying either an absolute path to the directory containing the
+plugin file, or a relative path from the directory containing the \c qmldir file to the directory
+containing the plugin file.
+
+
\section2 Namespaces - Named Imports
When importing content it by default imports types into the global namespace.
@@ -150,10 +155,10 @@ types to be referenced, or purely for readability.
To import a module into a namespace:
\code
-import Qt 4.6 as TheQtLibrary
+import Qt 4.7 as TheQtLibrary
\endcode
-Types from Qt 4.6 may then be used, but only by qualifying them with the namespace:
+Types from the Qt 4.7 module may then be used, but only by qualifying them with the namespace:
\code
TheQtLibrary.Rectangle { ... }
@@ -163,7 +168,7 @@ Multiple modules can be imported into the same namespace in the same way that mu
modules can be imported into the global namespace:
\code
-import Qt 4.6 as Nokia
+import Qt 4.7 as Nokia
import Ovi 1.0 as Nokia
\endcode
diff --git a/doc/src/declarative/network.qdoc b/doc/src/declarative/network.qdoc
index f1d4db1..0a26c68 100644
--- a/doc/src/declarative/network.qdoc
+++ b/doc/src/declarative/network.qdoc
@@ -64,7 +64,6 @@ Image {
Network transparency is supported throughout QML, for example:
\list
-\o Scripts - the \c source property of \l Script is a URL
\o Fonts - the \c source property of FontLoader is a URL
\o WebViews - the \c url property of WebView (obviously!)
\endlist
diff --git a/doc/src/declarative/qdeclarativedocument.qdoc b/doc/src/declarative/qdeclarativedocument.qdoc
index a210c98..cf3aae2 100644
--- a/doc/src/declarative/qdeclarativedocument.qdoc
+++ b/doc/src/declarative/qdeclarativedocument.qdoc
@@ -49,7 +49,7 @@ stored on a disk or network resource, but can also be constructed directly from
Here is a simple QML document:
\code
-import Qt 4.6
+import Qt 4.7
Rectangle {
width: 240; height: 320;
@@ -83,7 +83,7 @@ modifies the document prior to presentation to the QML runtime. \c import statem
do not "include" code in the document, but instead instruct the QML runtime on how to
resolve type references found in the document. Any type reference present in a QML
document - such as \c Rectangle and \c ListView - including those made within an
-\l {JavaScript Block} or \l {Property Binding}s, are \e resolved based exclusively on the
+\l {Inline JavaScript}{JavaScript block} or \l {Property Binding}s, are \e resolved based exclusively on the
import statements. QML does not import any modules by default, so at least one \c import
statement must be present or no elements will be available!
@@ -103,7 +103,7 @@ instantiated four times, each with a different value for its \c text property.
<table><tr><td>
\endraw
\code
-import Qt 4.6
+import Qt 4.7
BorderImage {
property alias text: textElement.text
@@ -152,7 +152,7 @@ These final two examples are behaviorally identical to the original document.
\row
\o
\code
-import Qt 4.6
+import Qt 4.7
Rectangle {
width: 240; height: 320;
@@ -170,7 +170,7 @@ Rectangle {
\endcode
\o
\code
-import Qt 4.6
+import Qt 4.7
Rectangle {
width: 240; height: 320;
diff --git a/doc/src/declarative/qdeclarativei18n.qdoc b/doc/src/declarative/qdeclarativei18n.qdoc
index 598c567..0a48dd9 100644
--- a/doc/src/declarative/qdeclarativei18n.qdoc
+++ b/doc/src/declarative/qdeclarativei18n.qdoc
@@ -72,7 +72,7 @@ that needs to be translated is enclosed in a call to \c qsTr().
hello.qml:
\qml
-import Qt 4.6
+import Qt 4.7
Rectangle {
width: 200; height: 200
diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc
index e80824d..d8b2a5d 100644
--- a/doc/src/declarative/qdeclarativemodels.qdoc
+++ b/doc/src/declarative/qdeclarativemodels.qdoc
@@ -54,7 +54,7 @@ delegate may bind to. The roles are exposed as properties of the
\e model context property, though this property is set as a default property
of the delegate so, unless there is a naming clash with a
property in the delegate, the roles are usually accessed unqualified. The
-example below would have a clash between he \e color role of the model and
+example below would have a clash between the \e color role of the model and
the \e color property of the Rectangle. The clash is avoided by referencing
the \e color property of the model by its full name: \e model.color.
@@ -309,13 +309,21 @@ There are no data roles.
The following example creates a ListView with five elements:
\code
-Component {
- id: itemDelegate
- Text { text: "I am item number: " + index }
-}
-ListView {
- model: 5
- delegate: itemDelegate
+Item {
+ width: 200
+ height: 250
+
+ Component {
+ id: itemDelegate
+ Text { text: "I am item number: " + index }
+ }
+
+ ListView {
+ anchors.fill: parent
+ model: 5
+ delegate: itemDelegate
+ }
+
}
\endcode
diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc
index 577e69a..181c504 100644
--- a/doc/src/declarative/qtbinding.qdoc
+++ b/doc/src/declarative/qtbinding.qdoc
@@ -108,7 +108,7 @@ QObject *window = component.create(windowContext);
\o
\code
// main.qml
-import Qt 4.6
+import Qt 4.7
Rectangle {
color: backgroundColor
@@ -198,7 +198,7 @@ the window text will update accordingly.
\code
// main.qml
-import Qt 4.6
+import Qt 4.7
Rectangle {
width: 240
@@ -287,7 +287,7 @@ int main(int argc, char **argv)
\o
\code
// main.qml
-import Qt 4.6
+import Qt 4.7
Rectangle {
MouseArea {
@@ -311,7 +311,7 @@ is to have a "running" property. This leads to much nicer QML code:
\o
\code
// main.qml
-import Qt 4.6
+import Qt 4.7
Rectangle {
MouseArea {
@@ -390,7 +390,7 @@ MyApplication::MyApplication()
\endcode
\code
// main.qml
-import Qt 4.6
+import Qt 4.7
Image {
source: "images/background.png"
diff --git a/doc/src/declarative/scope.qdoc b/doc/src/declarative/scope.qdoc
index 964f7d5..65553cf 100644
--- a/doc/src/declarative/scope.qdoc
+++ b/doc/src/declarative/scope.qdoc
@@ -126,7 +126,7 @@ following example shows a simple QML file that accesses some enumeration
values and calls an imported JavaScript function.
\code
-import Qt 4.6
+import Qt 4.7
import "code.js" as Code
ListView {
@@ -267,7 +267,7 @@ is used, the \c title property may resolve differently.
\code
// TitlePage.qml
-import Qt 4.6
+import Qt 4.7
Item {
property string title
@@ -283,7 +283,7 @@ Item {
}
// TitleText.qml
-import Qt 4.6
+import Qt 4.7
Text {
property int size
text: "<b>" + title + "</b>"
@@ -299,7 +299,7 @@ to use property interfaces, like this:
\code
// TitlePage.qml
-import Qt 4.6
+import Qt 4.7
Item {
id: root
property string title
@@ -318,7 +318,7 @@ Item {
}
// TitleText.qml
-import Qt 4.6
+import Qt 4.7
Text {
property string title
property int size
diff --git a/doc/src/deployment/qt-conf.qdoc b/doc/src/deployment/qt-conf.qdoc
index b195889..298f539 100644
--- a/doc/src/deployment/qt-conf.qdoc
+++ b/doc/src/deployment/qt-conf.qdoc
@@ -87,6 +87,7 @@
\row \o Libraries \o \c lib
\row \o Binaries \o \c bin
\row \o Plugins \o \c plugins
+ \row \o Imports \o \c imports
\row \o Data \o \c .
\row \o Translations \o \c translations
\row \o Settings \o \c .
diff --git a/doc/src/snippets/declarative/listview/highlight.qml b/doc/src/snippets/declarative/listview/highlight.qml
index 6a9d215..fe5cc53 100644
--- a/doc/src/snippets/declarative/listview/highlight.qml
+++ b/doc/src/snippets/declarative/listview/highlight.qml
@@ -45,7 +45,7 @@ Rectangle {
width: 180; height: 40
color: "lightsteelblue"; radius: 5
SpringFollow on y {
- source: list.currentItem.y
+ to: list.currentItem.y
spring: 3
damping: 0.2
}