diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-02-17 07:19:56 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-02-17 07:19:56 (GMT) |
commit | 2b3ffec298b1c210d0e978c6c0e9cc4f51e72294 (patch) | |
tree | 4a84e031115a5bc5f4a0b60099cdb433780f0a5b | |
parent | 7f6317c25e6c1ec457971ab70c850d4d2bbe4cd2 (diff) | |
download | Qt-2b3ffec298b1c210d0e978c6c0e9cc4f51e72294.zip Qt-2b3ffec298b1c210d0e978c6c0e9cc4f51e72294.tar.gz Qt-2b3ffec298b1c210d0e978c6c0e9cc4f51e72294.tar.bz2 |
Document loading QML from Qt resources.
-rw-r--r-- | doc/src/declarative/qtbinding.qdoc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index cae0263..2b427dc 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -358,5 +358,41 @@ void MyApplication::continueLoading() } } \endcode + +\section1 Qt Resources + +QML content can be loaded from \l {The Qt Resource System} using the \e qrc: URL scheme. +For example: + +\code +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>main.qml</file> + <file>images/background.png</file> +</qresource> +</RCC> +\endcode +\code +// main.cpp +MyApplication::MyApplication() +{ + // ... + component = new QmlComponent(engine, QUrl("qrc:/main.qml")); + if (component->isError()) { + qWarning() << component->errors(); + } else { + QObject *myObject = component->create(); + } +} +\endcode +\code +// main.qml +import Qt 4.6 + +Image { + source: "images/background.png" +} +\endcode + */ |