summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2017-12-14 12:37:28 +0100
committerSzabolcs David <davidsz@inf.u-szeged.hu>2018-01-22 11:14:06 +0000
commit14b58276822c12e8d21580f61869b5a9bbf43f22 (patch)
tree6760c73349d4f9e9a8fe27d1d0427a7a9c0e5be7
parentbdbfd0e5af4058fe83402831fced7f3b2644c962 (diff)
Deselect text on each fourth click
Triple click selects the entire paragraph and it should be deselected on a quadra click. Task-number: QTBUG-65649 Change-Id: I87c9405a202d8b6eacd7c19dbbcb051756c41220 Reviewed-by: Viktor Engelmann <viktor.engelmann@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/core/render_widget_host_view_qt.cpp3
-rw-r--r--tests/auto/quick/qmltests/data/tst_mouseClick.qml17
2 files changed, 19 insertions, 1 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 6fc775535..cae2094fd 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -1197,7 +1197,8 @@ void RenderWidgetHostViewQt::handleMouseEvent(QMouseEvent* event)
if (event->type() == QMouseEvent::MouseButtonPress) {
if (event->button() != m_clickHelper.lastPressButton
|| (event->timestamp() - m_clickHelper.lastPressTimestamp > static_cast<ulong>(qGuiApp->styleHints()->mouseDoubleClickInterval()))
- || (event->pos() - m_clickHelper.lastPressPosition).manhattanLength() > qGuiApp->styleHints()->startDragDistance())
+ || (event->pos() - m_clickHelper.lastPressPosition).manhattanLength() > qGuiApp->styleHints()->startDragDistance()
+ || m_clickHelper.clickCounter >= 3)
m_clickHelper.clickCounter = 0;
m_clickHelper.lastPressTimestamp = event->timestamp();
diff --git a/tests/auto/quick/qmltests/data/tst_mouseClick.qml b/tests/auto/quick/qmltests/data/tst_mouseClick.qml
index bd6625a90..d81e690fd 100644
--- a/tests/auto/quick/qmltests/data/tst_mouseClick.qml
+++ b/tests/auto/quick/qmltests/data/tst_mouseClick.qml
@@ -57,6 +57,10 @@ TestWebEngineView {
function mouseTripleClick(item, x, y) {
mouseMultiClick(item, x, y, 3);
}
+
+ function mouseQuadraClick(item, x, y) {
+ mouseMultiClick(item, x, y, 4);
+ }
}
@@ -109,5 +113,18 @@ TestWebEngineView {
mouseClick(webEngineView, center.x, center.y);
tryVerify(function() { return getTextSelection() == "" });
}
+
+ function test_quadraClick() {
+ webEngineView.settings.focusOnNavigationEnabled = true;
+ webEngineView.loadHtml("<html><body onload='document.getElementById(\"input\").focus()'>" +
+ "<form><input id='input' width='150' type='text' value='The Qt Company' /></form>" +
+ "</body></html>");
+ verify(webEngineView.waitForLoadSucceeded());
+
+ var center = getElementCenter("input");
+ webEngineView.testSupport.mouseQuadraClick(webEngineView, center.x, center.y);
+ verifyElementHasFocus("input");
+ tryVerify(function() { return getTextSelection() == "" });
+ }
}
}