m_container = new KItemListContainer(controller, this);
m_container->installEventFilter(this);
setFocusProxy(m_container);
- connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip);
- connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip);
+ connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, [=] { hideToolTip(); });
+ connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, [=] { hideToolTip(); });
controller->setSelectionBehavior(KItemListController::MultiSelection);
connect(controller, &KItemListController::itemActivated, this, &DolphinView::slotItemActivated);
break;
case QEvent::KeyPress:
+ hideToolTip(ToolTipManager::HideBehavior::Instantly);
if (GeneralSettings::useTabForSwitchingSplitView()) {
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
if (keyEvent->key() == Qt::Key_Tab && keyEvent->modifiers() == Qt::NoModifier) {
}
}
-void DolphinView::hideToolTip()
+void DolphinView::hideToolTip(const ToolTipManager::HideBehavior behavior)
{
#ifdef HAVE_BALOO
if (GeneralSettings::showToolTips()) {
- m_toolTipManager->hideToolTip();
+ m_toolTipManager->hideToolTip(behavior);
}
#endif
}
#include "dolphintabwidget.h"
#include "dolphin_export.h"
+#include "tooltips/tooltipmanager.h"
#include <KFileItem>
#include <KIO/Job>
*/
void updateViewState();
- void hideToolTip();
-
/**
* Calculates the number of currently shown files into
* \a fileCount and the number of folders into \a folderCount.
*/
void applyModeToView();
+ /**
+ * Hides tooltip displayed over element.
+ */
+ void hideToolTip(const ToolTipManager::HideBehavior behavior = ToolTipManager::HideBehavior::Later);
+
/**
* Helper method for DolphinView::paste() and DolphinView::pasteIntoFolder().
* Pastes the clipboard data into the URL \a url.
Q_ASSERT(!m_metaDataRequested);
}
-void ToolTipManager::hideToolTip()
+void ToolTipManager::hideToolTip(const HideBehavior behavior)
{
if (m_appliedWaitCursor) {
QApplication::restoreOverrideCursor();
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;
+ }
}
}
Q_OBJECT
public:
+ enum class HideBehavior {
+ Instantly,
+ Later
+ };
+
explicit ToolTipManager(QWidget* parent);
~ToolTipManager() override;
/**
* Hides the currently shown tooltip.
*/
- void hideToolTip();
+ void hideToolTip(const HideBehavior behavior = HideBehavior::Later);
signals:
/**