From 52b95888d504de051b57dd55ac340d17aa0ed759 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Mon, 28 Jun 2021 11:52:45 +0200 Subject: [PATCH] Add function to hide tooltip immediately The built in delay causes trouble on wayland where it can cause closing of other popups. --- src/declarativeimports/core/tooltip.cpp | 6 ++++++ src/declarativeimports/core/tooltip.h | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/declarativeimports/core/tooltip.cpp b/src/declarativeimports/core/tooltip.cpp index 0b0a38573..4fd08fff7 100644 --- a/src/declarativeimports/core/tooltip.cpp +++ b/src/declarativeimports/core/tooltip.cpp @@ -256,6 +256,12 @@ void ToolTip::hideToolTip() tooltipDialogInstance()->dismiss(); } +void ToolTip::hideImmediately() +{ + m_showTimer->stop(); + tooltipDialogInstance()->setVisible(false); +} + QVariant ToolTip::icon() const { if (m_icon.isValid()) { diff --git a/src/declarativeimports/core/tooltip.h b/src/declarativeimports/core/tooltip.h index e77a5f6c7..5124f59f4 100644 --- a/src/declarativeimports/core/tooltip.h +++ b/src/declarativeimports/core/tooltip.h @@ -164,10 +164,16 @@ public Q_SLOTS: void showToolTip(); /** - * Hides the tooltip if shown. Does not affect whether the tooltip area is active. + * Hides the tooltip after a grace period if shown. Does not affect whether the tooltip area is active. */ void hideToolTip(); + /** + * Hides the tooltip immediately, in comparison to hideToolTip. + * @since 5.84 + */ + void hideImmediately(); + protected: /// @cond INTERNAL_DOCS bool childMouseEventFilter(QQuickItem *item, QEvent *event) override;