diff options
author | Martin Jones <martin.jones@jollamobile.com> | 2014-07-11 14:10:49 +1000 |
---|---|---|
committer | Martin Jones <martin.jones@jollamobile.com> | 2014-07-16 07:54:58 +0200 |
commit | 112efda64ba24e7d9255a36065223e9800a50c21 (patch) | |
tree | c35446169d49b7ab4d4bf9a21b983cbc251206a5 /examples/quick/mousearea/mousearea.qml | |
parent | 427bee6cb616d515ae04bc47193e35e19e1b519e (diff) |
Add containsPress property to MouseArea
It is very common to use pressed and containsMouse properties
together to highlight a pressed item, e.g.
property bool highlighted: pressed && containsMouse
The containsPress property allows simplification and optimization of
user code.
[ChangeLog][QtQuick] Add containsPress property to MouseArea
Task-number: QTBUG-40130
Change-Id: Ie286d431154eb37a99e57e4cf881d68d7cbbe31d
Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
Diffstat (limited to 'examples/quick/mousearea/mousearea.qml')
-rw-r--r-- | examples/quick/mousearea/mousearea.qml | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/quick/mousearea/mousearea.qml b/examples/quick/mousearea/mousearea.qml index dac891d729..8958391715 100644 --- a/examples/quick/mousearea/mousearea.qml +++ b/examples/quick/mousearea/mousearea.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import QtQuick 2.0 +import QtQuick 2.4 Rectangle { id: box @@ -49,10 +49,12 @@ Rectangle { width: 120; height: 120 anchors.top: parent.top; anchors.left: parent.left; anchors.margins: 10 color: "red" + opacity: redSquareMouseArea.containsPress ? 0.6 : 1.0 Text { text: "Click"; font.pixelSize: 16; anchors.centerIn: parent } MouseArea { + id: redSquareMouseArea anchors.fill: parent hoverEnabled: true property string buttonID |