summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativeevents.cpp
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-11-25 00:11:01 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-11-25 00:12:30 (GMT)
commitb04df748d8c170a969eb6a3097cbda7a08fb3ea1 (patch)
tree3bab750a421acf47c1825110b2fefc68eaea27c5 /src/declarative/graphicsitems/qdeclarativeevents.cpp
parentcaca740ea1219227008c303b5f2fac24af5a62a0 (diff)
downloadQt-b04df748d8c170a969eb6a3097cbda7a08fb3ea1.zip
Qt-b04df748d8c170a969eb6a3097cbda7a08fb3ea1.tar.gz
Qt-b04df748d8c170a969eb6a3097cbda7a08fb3ea1.tar.bz2
Document KeyEvent::modifiers
Task-number: QTBUG-15569
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativeevents.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeevents.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeevents.cpp b/src/declarative/graphicsitems/qdeclarativeevents.cpp
index 61fd562..4b5e777 100644
--- a/src/declarative/graphicsitems/qdeclarativeevents.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeevents.cpp
@@ -108,6 +108,34 @@ Item {
so that ancestor items do not also respond to the same event.
*/
+/*!
+ \qmlproperty int KeyEvent::modifiers
+
+ This property holds the keyboard modifier flags that existed immediately
+ before the event occurred.
+
+ It contains a bitwise combination of:
+ \list
+ \o Qt.NoModifier - No modifier key is pressed.
+ \o Qt.ShiftModifier - A Shift key on the keyboard is pressed.
+ \o Qt.ControlModifier - A Ctrl key on the keyboard is pressed.
+ \o Qt.AltModifier - An Alt key on the keyboard is pressed.
+ \o Qt.MetaModifier - A Meta key on the keyboard is pressed.
+ \o Qt.KeypadModifier - A keypad button is pressed.
+ \endlist
+
+ For example, to react to a Shift key + Enter key combination:
+ \qml
+ Item {
+ focus: true
+ Keys.onPressed: {
+ if ((event.key == Qt.Key_Enter) && (event.modifiers & Qt.ShiftModifier))
+ doSomething();
+ }
+ }
+ \endqml
+*/
+
/*!
\qmlclass MouseEvent QDeclarativeMouseEvent
@@ -199,7 +227,7 @@ Item {
\qml
MouseArea {
onClicked: {
- if (mouse.button == Qt.LeftButton && mouse.modifiers & Qt.ShiftModifier)
+ if ((mouse.button == Qt.LeftButton) && (mouse.modifiers & Qt.ShiftModifier))
doSomething();
}
}