diff options
Diffstat (limited to 'doc/src/declarative')
-rw-r--r-- | doc/src/declarative/elements.qdoc | 7 | ||||
-rw-r--r-- | doc/src/declarative/extending.qdoc | 21 | ||||
-rw-r--r-- | doc/src/declarative/javascriptblocks.qdoc | 20 | ||||
-rw-r--r-- | doc/src/declarative/network.qdoc | 6 | ||||
-rw-r--r-- | doc/src/declarative/qtdeclarative.qdoc | 6 |
5 files changed, 19 insertions, 41 deletions
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index ce3a6e3..355c0f4 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -46,8 +46,6 @@ The following table lists the QML elements provided by the Qt Declarative module. -\bold {Standard Qt Declarative Elements} - \table 80% \header \o \bold {States} @@ -81,6 +79,7 @@ The following table lists the QML elements provided by the Qt Declarative module \o \l PropertyAction \o \l ScriptAction \o \l Transition +\o \l SmoothedFollow \o \l SpringFollow \o \l Behavior \endlist @@ -109,11 +108,7 @@ The following table lists the QML elements provided by the Qt Declarative module \o \l QtObject \o \l WorkerScript \endlist -\endtable -\bold {QML Items} - -\table 80% \header \o \bold {Basic Visual Items} \o \bold {Basic Interaction Items} diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index e1c6469..4d477c6 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -67,12 +67,11 @@ that derive from QObject. The QML engine has no intrinsic knowledge of any class types. Instead the programmer must define the C++ types, and their corresponding QML name. -Custom C++ types are declared QML types using a macro and a template function: +Custom C++ types are registered using a template function: \quotation \code -#define QML_DECLARE_TYPE(T) template<typename T> int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName) \endcode @@ -81,10 +80,6 @@ Calling qmlRegisterType() registers the C++ type \a T with the QML system, and m under the name \a qmlName in library \a uri version \a versionMajor.versionMinor. The \a qmlName can be the same as the C++ type name. -Generally the QML_DECLARE_TYPE() macro should be included immediately following -the type declaration (usually in its header file), and the template function qmlRegisterType() -called by the implementation. - Type \a T must be a concrete type that inherits QObject and has a default constructor. \endquotation @@ -149,21 +144,16 @@ property can be assigned. QML also supports assigning Qt interfaces. To assign to a property whose type is a Qt interface pointer, the interface must also be registered with QML. As they cannot be instantiated directly, registering a Qt interface is different -from registering a new QML type. The following macro and function are used instead: +from registering a new QML type. The following function is used instead: \quotation \code -#define QML_DECLARE_INTERFACE(T) template<typename T> int qmlRegisterInterface(const char *typeName) \endcode Registers the C++ interface \a T with the QML system as \a typeName. -Generally the QML_DECLARE_INTERFACE() macro should be included immediately -following the interface declaration (usually in its header file), and the -qmlRegisterInterface() template function called by the implementation. - Following registration, QML can coerce objects that implement this interface for assignment to appropriately typed properties. \endquotation @@ -198,11 +188,10 @@ To assign to a property, the property's type must have been registered with QML. Both the qmlRegisterType() and qmlRegisterInterface() template functions already shown can be used to register a type with QML. Additionally, if a type that acts purely as a base class that cannot be instantiated from QML needs to be -registered these macro and function can be used: +registered, the following function can be used: \quotation \code - #define QML_DECLARE_TYPE(T) template<typename T> int qmlRegisterType() \endcode @@ -212,10 +201,6 @@ function qmlRegisterType() does not define a mapping between the C++ class and a QML element name, so the type is not instantiable from QML, but it is available for type coercion. -Generally the QML_DECLARE_TYPE() macro should be included immediately following -the type declaration (usually in its header file), and the -qmlRegisterType() template function called from the implementation. - Type \a T must inherit QObject, but there are no restrictions on whether it is concrete or the signature of its constructor. \endquotation diff --git a/doc/src/declarative/javascriptblocks.qdoc b/doc/src/declarative/javascriptblocks.qdoc index 8ffe58c..7c0570e 100644 --- a/doc/src/declarative/javascriptblocks.qdoc +++ b/doc/src/declarative/javascriptblocks.qdoc @@ -47,7 +47,7 @@ QML encourages building UIs declaratively, using \l {Property Binding} and the composition of existing \l {QML Elements}. To allow the implementation of more advanced behavior, QML integrates tightly with imperative JavaScript code. -The JavaScript environment provided by QML is stricter than that in a webbrowser. +The JavaScript environment provided by QML is stricter than that in a web browser. In QML you cannot add, or modify, members of the JavaScript global object. It is possible to do this accidentally by using a variable without declaring it. In QML this will throw an exception, so all local variables should be explicitly @@ -66,7 +66,7 @@ them. \code Item { function factorial(a) { - a = Integer(a); + a = parseInt(a); if (a <= 0) return 1; else @@ -104,12 +104,12 @@ Item { } \endcode -Both relative and absolute JavaScript URLs can be imported. In the case of a -relative URL, the location is resolved relative to the location of the -\l {QML Document} that contains the import. If the script file is not accessible, -an error will occur. If the JavaScript needs to be fetched from a network +Both relative and absolute JavaScript URLs can be imported. In the case of a +relative URL, the location is resolved relative to the location of the +\l {QML Document} that contains the import. If the script file is not accessible, +an error will occur. If the JavaScript needs to be fetched from a network resource, the QML document has a "Loading" -\l {QDeclarativeComponent::status()}{status} until the script has been +\l {QDeclarativeComponent::status()}{status} until the script has been downloaded. Imported JavaScript files are always qualified using the "as" keyword. The @@ -143,7 +143,7 @@ stateless library through the use of a pragma, as shown in the following example .pragma library function factorial(a) { - a = Integer(a); + a = parseInt(a); if (a <= 0) return 1; else @@ -160,7 +160,7 @@ parameters. \section1 Running JavaScript at Startup It is occasionally necessary to run some imperative code at application (or -component instance) "startup". While it is tempting to just include the startup +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. @@ -180,7 +180,7 @@ Rectangle { } \endcode -Any element in a QML file - including nested elements and nested QML component +Any element in a QML file - including nested elements and nested QML component instances - can use this attached property. If there is more than one \c onCompleted() handler to execute at startup, they are run sequentially in an undefined order. diff --git a/doc/src/declarative/network.qdoc b/doc/src/declarative/network.qdoc index 0a26c68..d268a13 100644 --- a/doc/src/declarative/network.qdoc +++ b/doc/src/declarative/network.qdoc @@ -69,8 +69,10 @@ Network transparency is supported throughout QML, for example: \endlist Even QML types themselves can be on the network - if the \l {Qt Declarative UI Runtime}{qml} tool is used to load -\tt http://example.com/mystuff/Hello.qml and that content refers to a type "World", this -will load from \tt http://example.com/mystuff/World.qml just as it would for a local file. +\tt http://example.com/mystuff/Hello.qml and that content refers to a type "World", the engine +will load \tt http://example.com/mystuff/qmldir and resolve the type just as it would for a local file. +For example if the qmldir file contains the line "World World.qml", it will load +\tt http://example.com/mystuff/World.qml Any other resources that \tt Hello.qml referred to, usually by a relative URL, would similarly be loaded from the network. diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index cbb2146..b4d8a2e 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -70,9 +70,7 @@ \macro QML_DECLARE_TYPE() \relates QDeclarativeEngine - Declares a C++ type to be usable in the QML system. In addition - to this, a type must also be registered with the QML system using - qmlRegisterType(). + Equivalent to Q_DECLARE_METATYPE(TYPE) and Q_DECLARE_METATYPE(QDeclarativeListProperty<TYPE>) */ @@ -83,7 +81,6 @@ This template function registers the C++ type in the QML system with the name \a qmlName. in the library imported from \a uri having the version number composed from \a versionMajor and \a versionMinor. - The type should also haved been declared with the QML_DECLARE_TYPE() macro. Returns the QML type id. @@ -114,7 +111,6 @@ This template function registers the C++ type in the QML system under the name \a typeName. - The type should also haved been declared with the QML_DECLARE_TYPE() macro. Returns the QML type id. |