Small API adjustments of ToolTipManager as discussed with Aaron:
* clearContent() is back, but no default value to setContent(); * delayedHide() is no more public. After all I didn't rename it and make it full of static methods because I noticed the following in the meantime: 1) register/unregister being still around, and passing the QGraphicsWidget* in most methods, effectively makes it a manager; 2) all managers in libplasma use the singleton pattern, so let's keep consistency. CCMAIL: aseigo@kde.org svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=875285
This commit is contained in:
parent
32fa54a46d
commit
3488fd23c7
@ -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:
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user