diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-03-29 05:43:19 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-03-29 05:43:19 (GMT) |
commit | be53372df21a099474ac0b28b95f29a077a8b3f0 (patch) | |
tree | 4f1ccca05a3d219bc21d275e3173bb3b0f040304 /doc | |
parent | 7f01d8851f912051b35af7dd078372c9970d45fe (diff) | |
parent | 28bd5d733ba1b0eedd3fff24ad42ab0e5e87a2e6 (diff) | |
download | Qt-be53372df21a099474ac0b28b95f29a077a8b3f0.zip Qt-be53372df21a099474ac0b28b95f29a077a8b3f0.tar.gz Qt-be53372df21a099474ac0b28b95f29a077a8b3f0.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/declarative/extending.qdoc | 3 | ||||
-rw-r--r-- | doc/src/declarative/globalobject.qdoc | 5 | ||||
-rw-r--r-- | doc/src/declarative/modules.qdoc | 202 | ||||
-rw-r--r-- | doc/src/declarative/qmlruntime.qdoc | 5 |
4 files changed, 81 insertions, 134 deletions
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 3dce8c3..b6aa9da 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -654,9 +654,8 @@ declaring a new property, and the corresponding C++ type. \row \o string \o QString \row \o url \o QUrl \row \o color \o QColor -\row \o date \o QDate +\row \o date \o QDateTime \row \o var \o QVariant -\row \o variant \o QVariant \endtable QML supports two methods for adding a new property to a type: a new property diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index 9f6be12..addc192 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -301,4 +301,9 @@ When a database is first created, an INI file is also created specifying its cha This data can be used by application tools. +\section1 Logging + +\c console.log() and \c console.debug() can be used to print information +to the console. See \l{Debugging QML} for more information. + */ diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc index ae014c0..13658d8 100644 --- a/doc/src/declarative/modules.qdoc +++ b/doc/src/declarative/modules.qdoc @@ -42,159 +42,106 @@ /*! \page qdeclarativemodules.html \title Modules -\section1 QML Modules. -QUERY: Is a directory with no qmldir really a module? Assumed NO. +\section1 QML Modules -A \bold module is a collection of QML types. These types can be defined in QML, or in C++ -through a QDeclarativeExtensionPlugin. They can then be collected into a directory to comprise -a module. +A \bold {QML module} is a collection of QML types. They allow you to organize your QML content +into independent units. Modules have an optional versioning mechanism that allows for independent +upgradability of the modules. -Additionally a module can also be a collection of types which was compiled into your application, see \l{Extending QML in C++}. +There are two types of modules: +location modules (defined by a URL), +and +installed modules (defined by a URI). -While a directory containing types can be used to organize QML components, QML modules also contain a \c qmldir file. -This file provides a manifest of all types available in the module, -and allows versioned imports (among other things). A directory containing only QML files or plugins behaves similarly -to a module, but a QML module requires a \c qmldir file (unless it is written in C++ and compiled into your application). - -\section2 The \c qmldir File - -QML modules containing installed files and remote content require a file \c qmldir which specifies the -mapping from all type names to versioned QML files. It is a list of lines of the form: - -\code -# <Comment> -<TypeName> <InitialVersion> <File> -plugin <Name> [<Path>] -\endcode - -# <Comment> lines are ignored, and can be used for comments. - -<TypeName> <InitialVersion> <File> lines are used to add QML files as types. -<TypeName> is the type being made available; <InitialVersion> is a version -number like \c 4.0; <File> is the (relative) -file name of the QML file defining the type. - -plugin <Name> [<Path>] lines are used to add plugins (QDeclarativeExtensionPlugin subclasses -written in C++) to the module. The line starts with the keyword 'plugin'; <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 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. - -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), -since the \e first name-version match is used. - -Installed files do not need to import the module of which they are a part, as they can refer -to the other QML files in the module as relative (local) files. -If the module is imported from a remote location, those files must nevertheless be listed in -the \c qmldir file. Internal files can be marked with the \c internal keyword, to ensure -they are not visible outside the module: +Location modules types are defined in QML files and \l{QDeclarativeExtensionPlugin}{QML C++ plugins} +in a directory refered to directly by +the location URL, either on the local filesystem, or as a network resource. The URL that locates them +can be relative, in which case they actual URL is resolved by the QML file containing the import. +When importing a location module, a quoted URL is used: \code -internal <TypeName> <File> +import "https://qml.nokia.com/qml/example" 1.0 +import "https://qml.nokia.com/qml/example" as NokiaExample +import "mymodule" 1.0 +import "mymodule" \endcode -Installed and remote files \e must be referred to by version information described above, -local files \e may have it. - -The versioning system ensures that a given QML file will work regardless of the 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 -use those identifiers. - -\section1 Importing Modules - -To use types from a module it must be imported using the \c import statement. Successive -import statements override earlier import statements, however, since imports have version -qualifiers, changes in modules do not alter the semantics of imports. - -While it is possible to import some modules without specifying a version this is only advisable -during prototyping, where version numbers mean very little. The rest of the time it is recommended that -you take advantage of the versioning capabilities of the language. - -You can import a directory in the same way that you import a module, except that you cannot specify a version -number. This will import all the types in that directory as QML files or as part of plugins. - -Types \link adding-types defined in C++\endlink can be from types your application defines, standard QML types, -or types defined in plugins. To use any such types, you must import -the module defining them. For example, to use types from Qt, import it: +Installed modules can \e only be on the local file system or in application C++ code. Again they +are defined in QML files and \l{QDeclarativeExtensionPlugin}{QML C++ plugins} in a directory, +but the directory is indirectly referred to by the URI. The mapping to actual content is either +by application C++ code registering a C++ type to a module URI (see \l{Extending QML in C++}), +or in the referenced subdirectory of a path on the import path (see below). +When importing a location module, an un-quoted URI is used: \code -import Qt 4.6 +import com.nokia.qml.mymodule 1.0 +import com.nokia.qml.mymodule as MyModule \endcode -This makes available all types in Qt that were available in Qt 4.6, regardless of the -actual version of Qt executing the QML. So even if Qt 4.7 adds a type that would conflict -with a type you defined while using 4.6, that type is not imported, so there is no conflict. - -Types defined by plugins are made using QDeclarativeExtensionPlugin. Installed plugins and QML files -can both contribute types to the same module. +For either type of module, a \c qmldir file in the module directory defines the content of the module. This file is +optional for location modules, but only for local filesystem content or a single remote content with a namespace. +The second exception is explained in more detail in the section below on Namespaces. -\section1 Importing Types Defined in QML +\seciont2 The Import Path -When importing types \link components defined using QML\endlink, the syntax depends -on whether or not the types are installed on the system. +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. +From C++, the path is available via \l QDeclarativeEngine::importPathList() and can be prepended to +using \l QDeclarativeEngine::addImportPath(). -\section2 Installed QML Files +\section2 The \c qmldir File -To import types defined in QML files that are installed on the system running the -QML, a URI import is used: +Installed QML modules and remote content without a namespace require a file \c qmldir which +specifies the mapping from all type names to versioned QML files. It is a list of lines of the form: \code -import com.nokia.Example 1.0 +# <Comment> +<TypeName> [<InitialVersion>] <File> +internal <Name> <File> +plugin <Name> [<Path>] \endcode -Files imported in this way are found on the paths added by QDeclarativeEngine::addImportPath(), -which by default only inludes \c $QTDIR/qml, so the above would make available those types -defined in \c $QTDIR/qml/com/nokia/Example which are specified as being in version 1.0. -Installed plugins and QML files can both contribute types to the same module. - -The specification of types to versions is given by a special file, \c qmldir which must -exist in the module directory. The syntax is described below. - -The \c -L option to the \l {Qt Declarative UI Runtime}{qml} application also adds paths to the import path. - - -\section2 Local QML Files - -To import types defined in QML files in directories relative to the file importing them, -a quoted import directory is used: - -\code -import "path" -\endcode +# <Comment> lines are ignored, and can be used for comments. -This allows all components defined in the directory \c path to be used in -the component where this statement appears. Because no version number is specified, -all types in the directory will be imported. +<TypeName> <InitialVersion> <File> lines are used to add QML files as types. +<TypeName> is the type being made available; the optional <InitialVersion> is a version +number like \c 4.0; <File> is the (relative) +file name of the QML file defining the type. -In this case, and only this case, it is not necessary for the directory to include -a \c qmldir file, nor is it necessary to provide a version qualifier. The basis of this is -that the files in the subdirectory are assumed to be packaged with the importer, and therefore -they form a single versioned unit. It is however recommended that you add a qmldir file and create -a QML module, as this provides additional options such as more flexible versioning. If the directory -is a module then you can use a version qualifier, like below +Installed files do not need to import the module of which they are a part, as they can refer +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 -import "path" 1.0 +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. -\section2 Remote QML Files - -To import types defined in QML file at arbitrary network locations, a quoted absolute URL is used: +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), +since the \e first name-version match is used and a request for a version of a type +can be fulfilled by one defined in an earlier version of the module. -\code -import "http://url/.../" 1.0 -\endcode +Installed and remote files without a namespace \e must be referred to by version information described above, +local files \e may have it. -This works the same as for relative directory imports, except that the target location contain a QML module (\e must -include a \c qmldir file), and a version qualifier must be given. +The versioning system ensures that a given QML file will work regardless of the 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. -\section1 Namespaces - Named Imports +\section2 Namespaces - Named Imports When importing content it by default imports types into the global namespace. You may choose to import the module into another namespace, either to allow identically-named @@ -220,20 +167,15 @@ import Qt 4.6 as Nokia import Ovi 1.0 as Nokia \endcode -There is one special module, called Qt, which contains all of the types that are part of -Qt Declarative. While it still needs to be imported, this module can be used in all QML -files. - -While import statements are need to make any types available in QML, the directory of the +While import statements are needed to make any types available in QML, the directory of the current file is implicitly loaded. This is the exact same as if you had added 'import "."' to -every QML file. The effect of this is that you can automatically use Types defined in C++ plugins +every QML file. The effect of this is that you can automatically use types defined in C++ plugins or QML files if they reside in the same directory. - */ /* -See original requirement QT-558. +Original requirement is QT-558. */ diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc index cfef536..8bb3ec7 100644 --- a/doc/src/declarative/qmlruntime.qdoc +++ b/doc/src/declarative/qmlruntime.qdoc @@ -42,6 +42,7 @@ /*! \page qmlruntime.html \title Qt Declarative UI Runtime + \keyword qml runtime \ingroup qttools This page documents the \e{Declarative UI Runtime} for the Qt GUI @@ -148,8 +149,8 @@ import QDeclarativeViewer 1.0 as QDeclarativeViewer Item { - QDeclarativeViewer.Screen { id: viewerScreen } - state: (viewerScreen.orientation == QDeclarativeViewer.Screen.Landscape) ? 'landscape' : '' + QDeclarativeViewer.Screen { id: screen } + state: (screen.orientation == QDeclarativeViewer.Screen.Landscape) ? 'landscape' : '' } \endcode |