aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicktextedit/data/keyEventPropagation.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquicktextedit/data/keyEventPropagation.qml')
-rw-r--r--tests/auto/quick/qquicktextedit/data/keyEventPropagation.qml31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktextedit/data/keyEventPropagation.qml b/tests/auto/quick/qquicktextedit/data/keyEventPropagation.qml
new file mode 100644
index 0000000000..7793827b77
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/keyEventPropagation.qml
@@ -0,0 +1,31 @@
+import QtQuick
+
+FocusScope {
+ Component.onCompleted: edit.forceActiveFocus()
+
+ anchors.fill: parent
+
+ Keys.onPressed: function(event) { keyDown(event.key) }
+ Keys.onReleased: function(event) { keyUp(event.key) }
+ signal keyDown(int key)
+ signal keyUp(int key)
+
+ TextEdit {
+ id: edit
+ anchors.centerIn: parent
+ width: 50
+ height: 50
+ Keys.onPressed: function(event) {
+ event.accepted = event.key == Qt.Key_A || event.key == Qt.Key_Right
+ }
+ Keys.onReleased: function(event) {
+ event.accepted = event.key == Qt.Key_A
+ }
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: -5
+ color: "transparent"
+ border.width: 1
+ }
+ }
+}