aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorNico Vertriest <nico.vertriest@digia.com>2015-10-16 13:14:52 +0200
committerNico Vertriest <nico.vertriest@digia.com>2015-10-20 08:50:52 +0000
commit628c70c6d0aaf4e944b0943d46d304161fb26c72 (patch)
treee6e767ff139a94965bd6e599c2d6aff9ca133700 /src/qml
parente7e40e434430001ebebf20bde88ea2011cd07864 (diff)
Doc: solved various qdoc errors qtdeclarative
Task-number: QTBUG-43810 Change-Id: I2e9fa91d63c5998df50f3678e485135e8518916d Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/doc/src/javascript/resources.qdoc14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/qml/doc/src/javascript/resources.qdoc b/src/qml/doc/src/javascript/resources.qdoc
index 51354e9bf0..b831e2ba70 100644
--- a/src/qml/doc/src/javascript/resources.qdoc
+++ b/src/qml/doc/src/javascript/resources.qdoc
@@ -57,7 +57,7 @@ parameters if they are required.
An example of a code-behind implementation resource follows:
-\qml
+\code
// MyButton.qml
import QtQuick 2.0
import "my_button_impl.js" as Logic // a new instance of this JavaScript resource is loaded for each instance of Button.qml
@@ -74,11 +74,11 @@ Rectangle {
onClicked: Logic.onClicked(rect)
}
}
-\endqml
+\endcode
-\qml
+\code
// my_button_impl.js
-var clickCount = 0; // this state is separate for each instance of MyButton
+property var clickCount = 0; // this state is separate for each instance of MyButton
function onClicked(btn) {
clickCount += 1;
if ((clickCount % 5) == 0) {
@@ -87,7 +87,7 @@ function onClicked(btn) {
obj.color = Qt.rgba(0,1,0,1);
}
}
-\endqml
+\endcode
In general, simple logic should be defined in-line in the QML file, but more
complex logic should be separated into code-behind implementation resources
@@ -138,7 +138,7 @@ within a QML document which never calls the factorial function.
For example:
-\qml
+\code
// Calculator.qml
import QtQuick 2.0
import "factorial.js" as FactorialCalculator // this JavaScript resource is only ever loaded once by the engine, even if multiple instances of Calculator.qml are created
@@ -149,7 +149,7 @@ Text {
property int input: 17
text: "The factorial of " + input + " is: " + FactorialCalculator.factorial(input)
}
-\endqml
+\endcode
As they are shared, .pragma library files cannot access QML component instance
objects or properties directly, although QML values can be passed as function