From b8141609d2ee962b919e1f05f7bd12ebc2ca9d11 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 12 Oct 2017 10:04:34 +0200 Subject: QQuickToolTip: disable hover Tooltips are special popups that should not block hover, because it conflicts with the typical condition for showing tooltips on desktop platforms. Task-number: QTBUG-63644 Change-Id: Ie974aed23a7df8e4b926bec5fe717cb909d15842 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquicktooltip.cpp | 2 ++ tests/auto/controls/data/tst_tooltip.qml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp index bf83a725..25fb74ab 100644 --- a/src/quicktemplates2/qquicktooltip.cpp +++ b/src/quicktemplates2/qquicktooltip.cpp @@ -36,6 +36,7 @@ #include "qquicktooltip_p.h" #include "qquickpopup_p_p.h" +#include "qquickpopupitem_p_p.h" #include "qquickcontrol_p_p.h" #include @@ -172,6 +173,7 @@ QQuickToolTip::QQuickToolTip(QQuickItem *parent) Q_D(QQuickToolTip); d->allowVerticalFlip = true; d->allowHorizontalFlip = true; + d->popupItem->setHoverEnabled(false); // QTBUG-63644 } /*! diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml index c7973c69..a2078e09 100644 --- a/tests/auto/controls/data/tst_tooltip.qml +++ b/tests/auto/controls/data/tst_tooltip.qml @@ -294,4 +294,35 @@ TestCase { keyPress(Qt.Key_A) compare(shortcutActivatedSpy.count, 1) } + + Component { + id: hoverComponent + MouseArea { + id: hoverArea + property alias tooltip: tooltip + hoverEnabled: true + width: testCase.width + height: testCase.height + ToolTip { + id: tooltip + x: 10; y: 10 + width: 10; height: 10 + visible: hoverArea.containsMouse + } + } + } + + // QTBUG-63644 + function test_hover() { + var root = createTemporaryObject(hoverComponent, testCase) + verify(root) + + var tooltip = root.tooltip + verify(tooltip) + + for (var pos = 0; pos <= 25; pos += 5) { + mouseMove(root, pos, pos) + verify(tooltip.visible) + } + } } -- cgit v1.2.3