summaryrefslogtreecommitdiffstats
path: root/doc/src/declarative/modules.qdoc
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/declarative/modules.qdoc')
-rw-r--r--doc/src/declarative/modules.qdoc105
1 files changed, 105 insertions, 0 deletions
diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc
new file mode 100644
index 0000000..7c67f60
--- /dev/null
+++ b/doc/src/declarative/modules.qdoc
@@ -0,0 +1,105 @@
+/*!
+\target qmlmodules
+\page qmlmodules.html
+\title Modules
+
+A \bold module is a collection of QML types.
+
+To use types from a module it must be imported using the \c import statement. Successive
+import statements override earlier import statements.
+
+\section1 Importing Built-in Types
+
+To use built-in types, you must import the module defining them.
+For example, to use types from Qt, import it:
+
+\code
+import Qt 4.6
+\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.
+
+Modules can be compiled-in (such as the Qt module), or they can be
+defined in QML files.
+
+\section1 Importing 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
+
+This allows all components defined in the directory \c path to be used in
+the component where this statement appears.
+
+To import types defined in QML files that are installed somewhere on the system,
+an unquoted URI is used:
+
+\code
+import com.nokia.CoolStuff 1.0
+\endcode
+
+This will access file in the directory \c com/nokia/CoolStuff/, found in some
+location determined outside QML. See QmlEngine::addImportPath() and the \c -L option
+to the \l {qmlviewer}{viewer} application.
+
+The directory of installed files must include 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> <VersionRange> <File>
+\endcode
+
+<TypeName> is the type being made available; <VersionRange> is either a single version
+number like \c 4.0 or a range of minor versions like \c 4.0-2; <File> is the (relative)
+file name of the QML file defining the type.
+The same type can be provided by different files in different versions.
+If a type is in multiple major versions, it should be listed on a separate line.
+
+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.
+
+Installed 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 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
+types to be referenced, or purely for readability.
+
+To import a module into a namespace:
+
+\code
+import Qt 4.6 as TheQtLibrary
+\endcode
+
+Types from Qt 4.6 may then be used, but only by qualifying them with the namespace:
+
+\code
+TheQtLibrary.Rectangle { ... }
+\endcode
+
+Multiple modules can be imported into the same namespace in the same way that multiple
+modules can be imported into the global namespace:
+
+\code
+import Qt 4.6 as Nokia
+import Ovi 1.0 as Nokia
+\endcode
+*/
+
+/*
+
+See original requirement QT-558.
+
+*/