diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -698,6 +698,7 @@ void updateViewState(); void hideToolTip(); + void hideToolTipInstantly(); /** * Calculates the number of currently shown files into diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -744,6 +744,7 @@ break; case QEvent::KeyPress: + hideToolTipInstantly(); if (GeneralSettings::useTabForSwitchingSplitView()) { QKeyEvent* keyEvent = static_cast(event); if (keyEvent->key() == Qt::Key_Tab && keyEvent->modifiers() == Qt::NoModifier) { @@ -1423,6 +1424,15 @@ #endif } +void DolphinView::hideToolTipInstantly() +{ +#ifdef HAVE_BALOO + if (GeneralSettings::showToolTips()) { + m_toolTipManager->hideToolTip(ToolTipManager::HideBehavior::Instantly); + } +#endif +} + void DolphinView::calculateItemCount(int& fileCount, int& folderCount, KIO::filesize_t& totalFileSize) const diff --git a/src/views/tooltips/tooltipmanager.h b/src/views/tooltips/tooltipmanager.h --- a/src/views/tooltips/tooltipmanager.h +++ b/src/views/tooltips/tooltipmanager.h @@ -42,6 +42,11 @@ Q_OBJECT public: + enum class HideBehavior { + Instantly, + Later + }; + explicit ToolTipManager(QWidget* parent); ~ToolTipManager() override; @@ -56,7 +61,7 @@ /** * Hides the currently shown tooltip. */ - void hideToolTip(); + void hideToolTip(HideBehavior behavior = HideBehavior::Later); signals: /** diff --git a/src/views/tooltips/tooltipmanager.cpp b/src/views/tooltips/tooltipmanager.cpp --- a/src/views/tooltips/tooltipmanager.cpp +++ b/src/views/tooltips/tooltipmanager.cpp @@ -104,7 +104,7 @@ Q_ASSERT(!m_metaDataRequested); } -void ToolTipManager::hideToolTip() +void ToolTipManager::hideToolTip(HideBehavior behavior) { if (m_appliedWaitCursor) { QApplication::restoreOverrideCursor(); @@ -116,7 +116,14 @@ m_showToolTipTimer->stop(); m_contentRetrievalTimer->stop(); if (m_tooltipWidget) { - m_tooltipWidget->hideLater(); + switch (behavior) { + case HideBehavior::Instantly: + m_tooltipWidget->hide(); + break; + case HideBehavior::Later: + m_tooltipWidget->hideLater(); + break; + } } }