From 2b3ffec298b1c210d0e978c6c0e9cc4f51e72294 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 17 Feb 2010 17:19:56 +1000 Subject: Document loading QML from Qt resources. --- doc/src/declarative/qtbinding.qdoc | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) 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 + + + main.qml + images/background.png + + +\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 + */ -- cgit v0.12