summaryrefslogtreecommitdiffstats
path: root/doc/src/declarative/qtbinding.qdoc
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-02-24 02:42:00 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-02-24 02:42:00 (GMT)
commit7c76abb0dc4204043bec9b6fa315f9753a7986ae (patch)
treecee303672cfd138790645e731f2d69472564d4b7 /doc/src/declarative/qtbinding.qdoc
parent4066e60e859853cfe3240245ba05271e79839506 (diff)
downloadQt-7c76abb0dc4204043bec9b6fa315f9753a7986ae.zip
Qt-7c76abb0dc4204043bec9b6fa315f9753a7986ae.tar.gz
Qt-7c76abb0dc4204043bec9b6fa315f9753a7986ae.tar.bz2
Change class prefix to from QmlXXX to QDeclarativeXXX, QmlGraphicsXXX to QDeclarativeXXX.
Diffstat (limited to 'doc/src/declarative/qtbinding.qdoc')
-rw-r--r--doc/src/declarative/qtbinding.qdoc78
1 files changed, 39 insertions, 39 deletions
diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc
index 732ff86..66d537d 100644
--- a/doc/src/declarative/qtbinding.qdoc
+++ b/doc/src/declarative/qtbinding.qdoc
@@ -46,50 +46,50 @@
\tableofcontents
-The QML API is split into three main classes - QmlEngine, QmlComponent and QmlContext.
-QmlEngine provides the environment in which QML is run, QmlComponent encapsulates
-\l {QML Documents}, and QmlContext allows applications to expose data to QML component instances.
+The QML API is split into three main classes - QDeclarativeEngine, QDeclarativeComponent and QDeclarativeContext.
+QDeclarativeEngine provides the environment in which QML is run, QDeclarativeComponent encapsulates
+\l {QML Documents}, and QDeclarativeContext allows applications to expose data to QML component instances.
-QML also includes a convenience API, QmlView, for applications that simply want to embed QML
-components into a new QGraphicsView. QmlView covers up many of the details discussed below.
-While QmlView is mainly intended for rapid prototyping it can have uses in production applications.
+QML also includes a convenience API, QDeclarativeView, for applications that simply want to embed QML
+components into a new QGraphicsView. QDeclarativeView covers up many of the details discussed below.
+While QDeclarativeView is mainly intended for rapid prototyping it can have uses in production applications.
If you are looking at retrofitting an existing Qt application with QML,
read \l{Integrating QML with existing Qt UI code}.
\section1 Basic Usage
-Every application requires at least one QmlEngine. A QmlEngine allows the configuration of
+Every application requires at least one QDeclarativeEngine. A QDeclarativeEngine allows the configuration of
global settings that apply to all the QML component instances - such as the QNetworkAccessManager
that is used for network communications, and the path used for persistent storage.
-Multiple QmlEngine's are only needed if the application requires these settings to differ
+Multiple QDeclarativeEngine's are only needed if the application requires these settings to differ
between QML component instances.
-\l {QML Documents} are loaded using the QmlComponent class. Each QmlComponent instance
-represents a single QML document. A QmlComponent can be passed a document URL, or raw text
+\l {QML Documents} are loaded using the QDeclarativeComponent class. Each QDeclarativeComponent instance
+represents a single QML document. A QDeclarativeComponent can be passed a document URL, or raw text
representing the content of the document. The document URL can be a local filesystem URL, or
any network URL supported by QNetworkAccessManager.
-QML component instances can then be created by calling the QmlComponent::create() method. Here's
+QML component instances can then be created by calling the QDeclarativeComponent::create() method. Here's
an example of loading a QML document, and creating an object from it.
\code
-QmlEngine *engine = new QmlEngine(parent);
-QmlComponent component(engine, QUrl("main.qml"));
+QDeclarativeEngine *engine = new QDeclarativeEngine(parent);
+QDeclarativeComponent component(engine, QUrl("main.qml"));
QObject *myObject = component.create();
\endcode
\section1 Exposing Data
-QML components are instantiated in a QmlContext. A context allows the application to expose data
-to the QML component instance. A single QmlContext can be used to instantiate all the objects
-used by an application, or several QmlContext can be created for more fine grained control over
-the data exposed to each instance. If a context is not passed to the QmlComponent::create()
-method, the QmlEngine's \l {QmlEngine::rootContext()}{root context} is used. Data exposed through
+QML components are instantiated in a QDeclarativeContext. A context allows the application to expose data
+to the QML component instance. A single QDeclarativeContext can be used to instantiate all the objects
+used by an application, or several QDeclarativeContext can be created for more fine grained control over
+the data exposed to each instance. If a context is not passed to the QDeclarativeComponent::create()
+method, the QDeclarativeEngine's \l {QDeclarativeEngine::rootContext()}{root context} is used. Data exposed through
the root context is available to all object instances.
\section1 Simple Data
-To expose data to a QML component instance, applications set \l {QmlContext::setContextProperty()}
+To expose data to a QML component instance, applications set \l {QDeclarativeContext::setContextProperty()}
{context properties} which are then accessible by name from QML \l {Property Binding}s and
\l {JavaScript Blocks}. The following example shows how to expose a background color to a QML
file.
@@ -99,11 +99,11 @@ file.
\o
\code
// main.cpp
-QmlContext *windowContext = new QmlContext(engine->rootContext());
+QDeclarativeContext *windowContext = new QDeclarativeContext(engine->rootContext());
windowContext->setContextProperty("backgroundColor",
QColor(Qt::lightsteelblue));
-QmlComponent component(&engine, "main.qml");
+QDeclarativeComponent component(&engine, "main.qml");
QObject *window = component.create(windowContext);
\endcode
\o
@@ -125,14 +125,14 @@ Rectangle {
Context properties work just like normal properties in QML bindings - if the \c backgroundColor
context property in the previous example was changed to red, the component object instances would
all be automatically updated. Note that it is the responsibility of the creator to delete any
-QmlContext it constructs. If the \c windowContext in the example above is no longer needed when
+QDeclarativeContext it constructs. If the \c windowContext in the example above is no longer needed when
the \c window component instantiation is destroyed, the \c windowContext must be destroyed
explicitly. The simplest way to ensure this is to set \c window as \c windowContext's parent.
-QmlContexts form a tree - each QmlContext except for the root context has a parent. Child
-QmlContexts effectively inherit the context properties present in their parents. This gives
+QDeclarativeContexts form a tree - each QDeclarativeContext except for the root context has a parent. Child
+QDeclarativeContexts effectively inherit the context properties present in their parents. This gives
applications more freedom in partitioning the data exposed to different QML object instances.
-If a QmlContext sets a context property that is also set in one of its parents, the new context
+If a QDeclarativeContext sets a context property that is also set in one of its parents, the new context
property shadows that in the parent. In The following example, the \c background context property
in \c {Context 1} shadows the \c background context property in the root context.
@@ -185,10 +185,10 @@ int main(int argc, char **argv)
{
// ...
- QmlContext *windowContext = new QmlContext(engine->rootContext());
+ QDeclarativeContext *windowContext = new QDeclarativeContext(engine->rootContext());
windowContext->setContextProperty("palette", new CustomPalette);
- QmlComponent component(&engine, "main.qml");
+ QDeclarativeComponent component(&engine, "main.qml");
QObject *window = component.create(windowContext);
}
\endcode
@@ -230,7 +230,7 @@ binding that does not have a NOTIFY signal will cause QML to issue a warning at
\section2 Dynamic Structured Data
If an application is too dynamic to structure data as compile-time QObject types, dynamically
-structured data can be constructed at runtime using the QmlPropertyMap class.
+structured data can be constructed at runtime using the QDeclarativePropertyMap class.
\section1 Calling C++ methods from QML
@@ -279,7 +279,7 @@ int main(int argc, char **argv)
{
// ...
- QmlContext *context = engine->rootContext();
+ QDeclarativeContext *context = engine->rootContext();
context->setContextProperty("ledBlinker", new LEDBlinker);
// ...
@@ -329,15 +329,15 @@ Of course, it is also possible to call \l {Adding new methods}{functions declare
\section1 Network Components
-If the URL passed to QmlComponent is a network resource, or if the QML document references a
-network resource, the QmlComponent has to fetch the network data before it is able to create
-objects. In this case, the QmlComponent will have a \l {QmlComponent::Loading}{Loading}
-\l {QmlComponent::status()}{status}. An application will have to wait until the component
-is \l {QmlComponent::Ready}{Ready} before calling \l {QmlComponent::create()}.
+If the URL passed to QDeclarativeComponent is a network resource, or if the QML document references a
+network resource, the QDeclarativeComponent has to fetch the network data before it is able to create
+objects. In this case, the QDeclarativeComponent will have a \l {QDeclarativeComponent::Loading}{Loading}
+\l {QDeclarativeComponent::status()}{status}. An application will have to wait until the component
+is \l {QDeclarativeComponent::Ready}{Ready} before calling \l {QDeclarativeComponent::create()}.
The following example shows how to load a QML file from a network resource. After creating
-the QmlComponent, it tests whether the component is loading. If it is, it connects to the
-QmlComponent::statusChanged() signal and otherwise calls the \c {continueLoading()} method
+the QDeclarativeComponent, it tests whether the component is loading. If it is, it connects to the
+QDeclarativeComponent::statusChanged() signal and otherwise calls the \c {continueLoading()} method
directly. This test is necessary, even for URLs that are known to be remote, just in case
the component has been cached and is ready immediately.
@@ -345,9 +345,9 @@ the component has been cached and is ready immediately.
MyApplication::MyApplication()
{
// ...
- component = new QmlComponent(engine, QUrl("http://www.example.com/main.qml"));
+ component = new QDeclarativeComponent(engine, QUrl("http://www.example.com/main.qml"));
if (component->isLoading())
- QObject::connect(component, SIGNAL(statusChanged(QmlComponent::Status)),
+ QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)),
this, SLOT(continueLoading()));
else
continueLoading();
@@ -381,7 +381,7 @@ For example:
MyApplication::MyApplication()
{
// ...
- component = new QmlComponent(engine, QUrl("qrc:/main.qml"));
+ component = new QDeclarativeComponent(engine, QUrl("qrc:/main.qml"));
if (component->isError()) {
qWarning() << component->errors();
} else {