Commit ec97f1cf authored by Matthew Vogt's avatar Matthew Vogt

Merge remote branch 'gerrit/api_changes' into merge-master

Change-Id: I9c54ff2a8aadb2bf95667eb3cf0a48f8291ce927
parents 36bd7f61 0284817d

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

This diff is collapsed.
......@@ -58,7 +58,7 @@ 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 QDeclarativeEngine::offlineStoragePath(), currently as SQLite databases.
of QQmlEngine::offlineStoragePath(), currently as SQLite databases.
Database connections are automatically closed during Javascript garbage collection.
......@@ -180,7 +180,7 @@
\inlineimage declarative-colors.png
\snippet doc/src/snippets/declarative/colors.qml colors
\snippet doc/src/snippets/qml/colors.qml colors
Or with the \l{QML:Qt::rgba()}{Qt.rgba()}, \l{QML:Qt::hsla()}{Qt.hsla()}, \l{QML:Qt::darker()}{Qt.darker()},
\l{QML:Qt::lighter()}{Qt.lighter()} or \l{QML:Qt::tint()}{Qt.tint()} functions:
......@@ -57,7 +57,7 @@ models.
\bold{Note:} There is no way for the view to know that the contents of a QStringList
have changed. If the QStringList changes, it will be necessary to reset
the model by calling QDeclarativeContext::setContextProperty() again.
the model by calling QQmlContext::setContextProperty() again.
\section1 QObjectList-based model
......@@ -92,7 +92,7 @@ models.
Note: There is no way for the view to know that the contents of a QList
have changed. If the QList changes, it will be necessary to reset
the model by calling QDeclarativeContext::setContextProperty() again.
the model by calling QQmlContext::setContextProperty() again.
\section1 QAbstractItemModel
......@@ -160,10 +160,10 @@ models.
\section1 Exposing C++ Data Models to QML
The above examples use QDeclarativeContext::setContextProperty() to set
The above examples use QQmlContext::setContextProperty() to set
model values directly in QML components. An alternative to this is to
register the C++ model class as a QML type from a QML C++ plugin using
QDeclarativeExtensionPlugin. This would allow the model classes to be
QQmlExtensionPlugin. This would allow the model classes to be
created directly as elements within QML:
......@@ -171,7 +171,7 @@ created directly as elements within QML:
class MyModelPlugin : public QDeclarativeExtensionPlugin
class MyModelPlugin : public QQmlExtensionPlugin
void registerTypes(const char *uri)
......@@ -52,7 +52,7 @@ For better readability, we separate these different parts with an empty line.
For example, a hypothetical \i photo QML object would look like this:
\snippet doc/src/snippets/declarative/codingconventions/photo.qml 0
\snippet doc/src/snippets/qml/codingconventions/photo.qml 0
\section1 Grouped Properties
......@@ -62,11 +62,11 @@ we use the \i {group notation} rather than the \i {dot notation} to improve read
For example, this:
\snippet doc/src/snippets/declarative/codingconventions/dotproperties.qml 0
\snippet doc/src/snippets/qml/codingconventions/dotproperties.qml 0
can be written like this:
\snippet doc/src/snippets/declarative/codingconventions/dotproperties.qml 1
\snippet doc/src/snippets/qml/codingconventions/dotproperties.qml 1
\section1 Private Properties
......@@ -78,7 +78,7 @@ the implementation. As a convention, private properties begin with two
accessible but is not meant for public use. Note that QML and JavaScript will
grant the user access to these properties.
\snippet doc/src/snippets/declarative/codingconventions/private.qml 0
\snippet doc/src/snippets/qml/codingconventions/private.qml 0
\section1 Lists
......@@ -89,30 +89,30 @@ For example, it is very common for a component to only have one state.
In this case, instead of:
\snippet doc/src/snippets/declarative/codingconventions/lists.qml 0
\snippet doc/src/snippets/qml/codingconventions/lists.qml 0
we will write this:
\snippet doc/src/snippets/declarative/codingconventions/lists.qml 1
\snippet doc/src/snippets/qml/codingconventions/lists.qml 1
\section1 JavaScript Code
If the script is a single expression, we recommend writing it inline:
\snippet doc/src/snippets/declarative/codingconventions/javascript.qml 0
\snippet doc/src/snippets/qml/codingconventions/javascript.qml 0
If the script is only a couple of lines long, we generally use a block:
\snippet doc/src/snippets/declarative/codingconventions/javascript.qml 1
\snippet doc/src/snippets/qml/codingconventions/javascript.qml 1
If the script is more than a couple of lines long or can be used by different objects, we recommend creating a function and calling it like this:
\snippet doc/src/snippets/declarative/codingconventions/javascript.qml 2
\snippet doc/src/snippets/qml/codingconventions/javascript.qml 2
For long scripts, we will put the functions in their own JavaScript file and import it like this:
\snippet doc/src/snippets/declarative/codingconventions/javascript-imports.qml 0
\snippet doc/src/snippets/qml/codingconventions/javascript-imports.qml 0
......@@ -148,11 +148,11 @@ If you set \c {QML_IMPORT_TRACE=1} before running the \l {QML Viewer}
(or your QML C++ application), you will see output similar to this:
QDeclarativeImportDatabase::addImportPath "/qt-sdk/imports"
QDeclarativeImportDatabase::addImportPath "/qt-sdk/bin/"
QDeclarativeImportDatabase::addToImport 0x106237370 "." -1.-1 File as ""
QDeclarativeImportDatabase::addToImport 0x106237370 "Qt" 4.7 Library as ""
QDeclarativeImportDatabase::resolveType "Rectangle" = "QDeclarativeRectangle"
QQmlImportDatabase::addImportPath "/qt-sdk/imports"
QQmlImportDatabase::addImportPath "/qt-sdk/bin/"
QQmlImportDatabase::addToImport 0x106237370 "." -1.-1 File as ""
QQmlImportDatabase::addToImport 0x106237370 "Qt" 4.7 Library as ""
QQmlImportDatabase::resolveType "Rectangle" = "QDeclarativeRectangle"
......@@ -80,31 +80,31 @@ the component. This function can take one or two arguments:
Here is an example. First there is \c Sprite.qml, which defines a simple QML component:
\snippet doc/src/snippets/declarative/Sprite.qml 0
\snippet doc/src/snippets/qml/Sprite.qml 0
Our main application file, \c main.qml, imports a \c componentCreation.js JavaScript file
that will create \c Sprite objects:
\snippet doc/src/snippets/declarative/createComponent.qml 0
\snippet doc/src/snippets/qml/createComponent.qml 0
Here is \c componentCreation.js. Notice it checks whether the component \l{Component::status}{status} is
\c Component.Ready before calling \l {Component::createObject()}{createObject()}
in case the QML file is loaded over a network and thus is not ready immediately.
\snippet doc/src/snippets/declarative/componentCreation.js vars
\snippet doc/src/snippets/qml/componentCreation.js vars
\snippet doc/src/snippets/declarative/componentCreation.js func
\snippet doc/src/snippets/declarative/componentCreation.js remote
\snippet doc/src/snippets/declarative/componentCreation.js func-end
\snippet doc/src/snippets/qml/componentCreation.js func
\snippet doc/src/snippets/qml/componentCreation.js remote
\snippet doc/src/snippets/qml/componentCreation.js func-end
\snippet doc/src/snippets/declarative/componentCreation.js finishCreation
\snippet doc/src/snippets/qml/componentCreation.js finishCreation
If you are certain the QML file to be loaded is a local file, you could omit the \c finishCreation()
function and call \l {Component::createObject()}{createObject()} immediately:
\snippet doc/src/snippets/declarative/componentCreation.js func
\snippet doc/src/snippets/declarative/componentCreation.js local
\snippet doc/src/snippets/declarative/componentCreation.js func-end
\snippet doc/src/snippets/qml/componentCreation.js func
\snippet doc/src/snippets/qml/componentCreation.js local
\snippet doc/src/snippets/qml/componentCreation.js func-end
Notice in both instances, \l {Component::createObject()}{createObject()} is called with
\c appWindow passed as an argument so that the created object will become a child of the
......@@ -124,7 +124,7 @@ use the signal \c connect() method. See
If the QML is not defined until runtime, you can create a QML item from
a string of QML using the \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} function, as in the following example:
\snippet doc/src/snippets/declarative/createQmlObject.qml 0
\snippet doc/src/snippets/qml/createQmlObject.qml 0
The first argument is the string of QML to create. Just like in a new file, you will need to
import any types you wish to use. The second argument is the parent item for the new item;
......@@ -145,7 +145,7 @@ The actual creation context depends on how an item is created:
\o If \l {QML:Qt::createComponent()}{Qt.createComponent()} is used, the creation context
is the QDeclarativeContext in which this method is called
is the QQmlContext in which this method is called
\o If \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
if called, the creation context is the context of the parent item passed to this method
\o If a \c {Component{}} item is defined and \l {Component::createObject()}{createObject()}
......@@ -181,8 +181,8 @@ component. Each instance runs a NumberAnimation, and when the animation has fini
\o \c SelfDestroyingRect.qml
\o \snippet doc/src/snippets/declarative/dynamicObjects-destroy.qml 0
\o \snippet doc/src/snippets/declarative/SelfDestroyingRect.qml 0
\o \snippet doc/src/snippets/qml/dynamicObjects-destroy.qml 0
\o \snippet doc/src/snippets/qml/SelfDestroyingRect.qml 0
......@@ -209,6 +209,6 @@ destroyed if they were dynamically created.
Objects created with \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
can similarly be destroyed using \c destroy():
\snippet doc/src/snippets/declarative/createQmlObject.qml 0
\snippet doc/src/snippets/declarative/createQmlObject.qml destroy
\snippet doc/src/snippets/qml/createQmlObject.qml 0
\snippet doc/src/snippets/qml/createQmlObject.qml destroy
......@@ -100,14 +100,14 @@ Here is our \c PieChart class, defined in \c piechart.h:
\snippet declarative/tutorials/extending/chapter1-basics/piechart.h 0
The class inherits from QDeclarativeItem because we want to override
QDeclarativeItem::paint() in order to draw. If the class just represented some
The class inherits from QQuickItem because we want to override