aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2018-03-21 12:28:00 +0100
committerPaul Wicking <paul.wicking@qt.io>2018-04-09 09:37:43 +0000
commitbdf0771a695f144dcd91f0f9a6cc6b81c5763d87 (patch)
tree46bc198fb7edb4ea65632673d4cb3795f6469441 /src
parent55400f1f194e5abc368c25313caccd5818166fb8 (diff)
Doc: Remove erroneous example
The current documentation is not current anymore. Removed faulty example and added link to relevant page for more information. Task-number: QTBUG-67082 Change-Id: Ic2d29ab358b227289480d9986679676048a35821 Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qml/doc/src/javascript/hostenvironment.qdoc18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/qml/doc/src/javascript/hostenvironment.qdoc b/src/qml/doc/src/javascript/hostenvironment.qdoc
index d11e96df2b..eb40f10065 100644
--- a/src/qml/doc/src/javascript/hostenvironment.qdoc
+++ b/src/qml/doc/src/javascript/hostenvironment.qdoc
@@ -154,10 +154,11 @@ This restriction exists as the QML environment is not yet fully established.
To run code after the environment setup has completed, see
\l {JavaScript in Application Startup Code}.
-\li The value of \c this is currently undefined in QML in the majority of contexts.
+\li The value of \c this is undefined in QML in the majority of contexts.
The \c this keyword is supported when binding properties from JavaScript.
-In all other situations, the value of
+In QML binding expressions, QML signal handlers, and QML declared functions,
+\c this refers to the scope object. In all other situations, the value of
\c this is undefined in QML.
To refer to a specific object, provide an \c id. For example:
@@ -168,20 +169,17 @@ Item {
function mouseAreaClicked(area) {
console.log("Clicked in area at: " + area.x + ", " + area.y);
}
- // This will not work because this is undefined
+ // This will pass area to the function
MouseArea {
- height: 50; width: 200
- onClicked: mouseAreaClicked(this)
- }
- // This will pass area2 to the function
- MouseArea {
- id: area2
+ id: area
y: 50; height: 50; width: 200
- onClicked: mouseAreaClicked(area2)
+ onClicked: mouseAreaClicked(area)
}
}
\endqml
+\sa {Scope and Naming Resolution}
+
\endlist