diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2015-02-09 01:16:51 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@theqtcompany.com> | 2016-05-23 07:12:40 +0000 |
commit | e7da97bf71108a0acd72629e383f884e2d756477 (patch) | |
tree | 2bd207a2440584a884ff0176f166c262f970f298 /tests/auto/quick/qquicktextinput/data | |
parent | a82094b63b8993630c37f7a71dac19d3f96b2804 (diff) |
QQuickWindow: Only send focus events to items that actually gain focus
Sending focus events may result in further changes to which item actually has
focus, so we cannot blindly send the focus events without first checking that it
hasn't subsequently changed.
To accomplish this, we delay sending events as long as possible, ensuring that
all necessary bookkeeping is done first to ensure internal consistency.
Task-number: QTBUG-40145
Change-Id: I7d93b3f8e3fea2ecce2151c88c29601deda12453
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Diffstat (limited to 'tests/auto/quick/qquicktextinput/data')
-rw-r--r-- | tests/auto/quick/qquicktextinput/data/focusOnlyOneOnPress.qml | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktextinput/data/focusOnlyOneOnPress.qml b/tests/auto/quick/qquicktextinput/data/focusOnlyOneOnPress.qml new file mode 100644 index 0000000000..037b36c8ff --- /dev/null +++ b/tests/auto/quick/qquicktextinput/data/focusOnlyOneOnPress.qml @@ -0,0 +1,32 @@ +import QtQuick 2.2 + +Rectangle { + width: 400 + height: 400 + + Column { + spacing: 5 + TextInput { + objectName: "first" + onEditingFinished: second.focus = true + width: 100 + Rectangle { anchors.fill: parent; color: parent.activeFocus ? "red" : "blue"; opacity: 0.3 } + } + TextInput { + id: second + objectName: "second" + onEditingFinished: third.focus = true + width: 100 + Rectangle { anchors.fill: parent; color: parent.activeFocus ? "red" : "blue"; opacity: 0.3 } + } + TextInput { + objectName: "third" + id: third + width: 100 + Rectangle { anchors.fill: parent; color: parent.activeFocus ? "red" : "blue"; opacity: 0.3 } + } + Component.onCompleted: { + second.focus = true + } + } +} |