aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-11-02 18:55:26 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2017-11-03 10:37:26 +0000
commita2d1f1ad14ca5e1123abe07329a28500ce71678d (patch)
tree8113e4f29c92f1d00c737a89d22f35c0f1966c3c /tests/auto
parentfbb5e0310687f8c628dc6e82a5f8b80fcd972f60 (diff)
QQuickTextField: retain selection on right mouse button click
QQuickTextField wants to emit pressed(), released(), and pressAndHold() signals not only on left, but on all mouse button clicks. Therefore it explicitly sets accepted mouse buttons to all. However, the base class, QQuickTextInput, has only been prepared to handle left (selection) and middle (paste) mouse buttons. Don't pass right mouse button -only events to the base class to avoid it clearing selection on right click. Task-number: QTBUG-64048 Change-Id: I015820c78995cc8dd7cbeb16fca0f9b991040bad Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/controls/data/tst_textfield.qml15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_textfield.qml b/tests/auto/controls/data/tst_textfield.qml
index deb4b6ff..dad47e23 100644
--- a/tests/auto/controls/data/tst_textfield.qml
+++ b/tests/auto/controls/data/tst_textfield.qml
@@ -416,4 +416,19 @@ TestCase {
mouseClick(control, rect.x + rect.width / 2, rect.y + rect.height / 2)
compare(control.selectedText, "Qt Quick Controls 2 TextArea")
}
+
+ // QTBUG-64048
+ function test_rightClick() {
+ var control = createTemporaryObject(textField, testCase, {text: "TextField", selectByMouse: true})
+ verify(control)
+
+ control.selectAll()
+ compare(control.selectedText, "TextField")
+
+ mouseClick(control, control.width / 2, control.height / 2, Qt.RightButton)
+ compare(control.selectedText, "TextField")
+
+ mouseClick(control, control.width / 2, control.height / 2, Qt.LeftButton | Qt.RightButton)
+ compare(control.selectedText, "")
+ }
}