aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2012-11-22 16:54:15 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-23 09:41:25 +0100
commitb5298660aeff41e5cd46abc680c9d23aca25996b (patch)
treee9831b08f44a9bf77b41a41bcf72550907e27e39 /src
parent4074fb7134c93e9b04b327e70c89d2e8bcc8fcc5 (diff)
docs: Separate qml and c++ examples
Change-Id: I1d9e2e281bff2bb77a8bdf53726d3c452e3fe911 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/doc/src/javascript/expressions.qdoc14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/qml/doc/src/javascript/expressions.qdoc b/src/qml/doc/src/javascript/expressions.qdoc
index 94315b21f1..c8304256cc 100644
--- a/src/qml/doc/src/javascript/expressions.qdoc
+++ b/src/qml/doc/src/javascript/expressions.qdoc
@@ -369,10 +369,12 @@ unless the client explicitly preserves it.
\section2 Example One: Automatic Release
In the following example, the scarce resource will be automatically released
-after the binding evaluation is complete.
+after the binding evaluation is complete. Assume we have the following qml file:
\snippet qml/integrating-javascript/scarceresources/exampleOne.qml 0
+And then use it from C++:
+
\snippet qml/integrating-javascript/scarceresources/avatarExample.cpp 1
\section2 Example Two: Automatic Release Prevented By Reference
@@ -384,6 +386,8 @@ scarce resource.
\snippet qml/integrating-javascript/scarceresources/exampleTwo.qml 0
+And from C++:
+
\snippet qml/integrating-javascript/scarceresources/avatarExample.cpp 2
\section2 Example Three: Explicit Preservation
@@ -392,10 +396,13 @@ In this example, the resource must be explicitly preserved in order
to prevent the declarative engine from automatically releasing the
resource after evaluation of the imported script.
+We create a JavaScript file:
\snippet qml/integrating-javascript/scarceresources/exampleThree.js 0
+Import it in QML:
\snippet qml/integrating-javascript/scarceresources/exampleThree.qml 0
+Run it in C++:
\snippet qml/integrating-javascript/scarceresources/avatarExample.cpp 3
\section2 Example Four: Explicit Destruction
@@ -405,10 +412,13 @@ scarce resource variant. This example shows how a client may free system
resources by releasing the scarce resource held in a JavaScript object, if
required, during evaluation of a JavaScript expression.
+We create a JavaScript file:
\snippet qml/integrating-javascript/scarceresources/exampleFour.js 0
+Import it in QML:
\snippet qml/integrating-javascript/scarceresources/exampleFour.qml 0
+Run it in C++:
\snippet qml/integrating-javascript/scarceresources/avatarExample.cpp 4
\section2 Example Five: Explicit Destruction and JavaScript References
@@ -419,8 +429,10 @@ to one scarce resource is held, and the client calls destroy() on one
of those references (to explicitly release the scarce resource), all of
the references will be affected.
+
\snippet qml/integrating-javascript/scarceresources/exampleFive.qml 0
+Run it in C++:
\snippet qml/integrating-javascript/scarceresources/avatarExample.cpp 5
*/