diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-10-12 10:04:34 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-10-12 09:30:10 +0000 |
commit | b8141609d2ee962b919e1f05f7bd12ebc2ca9d11 (patch) | |
tree | e881cfcad5e98a8cf38efe77f8962cad5232d1de | |
parent | 0007db13236fcee4ca90b885a67cc7de0f40836d (diff) |
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 <mitch.curtis@qt.io>
-rw-r--r-- | src/quicktemplates2/qquicktooltip.cpp | 2 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_tooltip.qml | 31 |
2 files changed, 33 insertions, 0 deletions
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 <QtCore/qbasictimer.h> @@ -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) + } + } } |