diff --git a/tooltipmanager.cpp b/tooltipmanager.cpp index 32522b596..5a70c47cc 100644 --- a/tooltipmanager.cpp +++ b/tooltipmanager.cpp @@ -81,6 +81,8 @@ public : void clearTips(); + void doDelayedHide(); + QGraphicsWidget *currentWidget; QTimer *showTimer; QTimer *hideTimer; @@ -171,11 +173,11 @@ bool ToolTipManager::isVisible(QGraphicsWidget *widget) const } } -void ToolTipManager::delayedHide() +void ToolTipManagerPrivate::doDelayedHide() { - d->showTimer->stop(); // stop the timer to show the tooltip - d->delayedHide = true; - d->hideTimer->start(250); + showTimer->stop(); // stop the timer to show the tooltip + delayedHide = true; + hideTimer->start(250); } void ToolTipManager::hide(QGraphicsWidget *widget) @@ -242,6 +244,11 @@ void ToolTipManager::setContent(QGraphicsWidget *widget, const Content &data) tooltip->updateTheme(); } +void ToolTipManager::clearContent(QGraphicsWidget *widget) +{ + setContent(widget, Content()); +} + void ToolTipManager::setState(ToolTipManager::State state) { d->state = state; @@ -409,7 +416,7 @@ bool ToolTipManager::eventFilter(QObject *watched, QEvent *event) } case QEvent::GraphicsSceneHoverLeave: - delayedHide(); + d->doDelayedHide(); break; case QEvent::GraphicsSceneMousePress: diff --git a/tooltipmanager.h b/tooltipmanager.h index 5d4941d2a..5dffaf624 100644 --- a/tooltipmanager.h +++ b/tooltipmanager.h @@ -120,11 +120,6 @@ public: */ bool isVisible(QGraphicsWidget *widget) const; - /** - * Hides the currently showing tooltip after a short amount of time. - */ - void delayedHide(); - /** * Hides the tooltip for a widget immediately. * @@ -172,7 +167,13 @@ public: * is passed in, the tooltip content will be reset. */ void setContent(QGraphicsWidget *widget, - const ToolTipManager::Content &data = ToolTipManager::Content()); + const ToolTipManager::Content &data); + + /** + * Clears the tooltip data associated with this widget, but keeps + * the widget registered. + */ + void clearContent(QGraphicsWidget *widget); /** * Sets the current state of the manager.