first set of API adjustments, via Kevin "API Review Bitch" Ottens

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=874234
This commit is contained in:
Aaron J. Seigo 2008-10-21 01:01:12 +00:00
parent 4253ba670d
commit 70abf9ff86
2 changed files with 16 additions and 78 deletions

View File

@ -156,7 +156,7 @@ void ToolTipManager::showToolTip(QGraphicsWidget *widget)
}
}
bool ToolTipManager::isWidgetToolTipDisplayed(QGraphicsWidget *widget)
bool ToolTipManager::isToolTipVisible(QGraphicsWidget *widget) const
{
ToolTip *tooltip = d->tooltips.value(widget);
if (tooltip) {
@ -233,40 +233,6 @@ void ToolTipManager::setToolTipContent(QGraphicsWidget *widget, const ToolTipCon
tooltip->updateTheme();
}
void ToolTipManager::clearToolTipContent(QGraphicsWidget *widget)
{
ToolTipContent t;
setToolTipContent(widget, t);
}
bool ToolTipManager::widgetHasToolTip(QGraphicsWidget *widget) const
{
return d->tooltips.contains(widget);
}
void ToolTipManager::setToolTipActivated(QGraphicsWidget *widget, bool enable)
{
registerWidget(widget);
ToolTip *tooltip = d->tooltips.value(widget);
tooltip->setActivated(enable);
if (!enable) {
hideToolTip(widget);
} else if (d->currentWidget) {
showToolTip(widget);
}
}
bool ToolTipManager::isToolTipActivated(QGraphicsWidget *widget)
{
if (!d->tooltips.contains(widget)) {
return false;
}
ToolTip *tooltip = d->tooltips.value(widget);
return tooltip->isActivated();
}
void ToolTipManagerPrivate::themeUpdated()
{
QHashIterator<QGraphicsWidget*, ToolTip *> iterator(tooltips);
@ -372,7 +338,7 @@ bool ToolTipManager::eventFilter(QObject *watched, QEvent *event)
case QEvent::GraphicsSceneHoverMove:
// If the tooltip isn't visible, run through showing the tooltip again
// so that it only becomes visible after a stationary hover
if (Plasma::ToolTipManager::self()->isWidgetToolTipDisplayed(widget)) {
if (Plasma::ToolTipManager::self()->isToolTipVisible(widget)) {
break;
}
@ -386,7 +352,7 @@ bool ToolTipManager::eventFilter(QObject *watched, QEvent *event)
case QEvent::GraphicsSceneHoverEnter:
{
// Check that there is a tooltip to show
if (!widgetHasToolTip(widget)) {
if (!d->tooltips.contains(widget)) {
break;
}

View File

@ -98,18 +98,6 @@ public:
*/
static ToolTipManager *self();
/**
* Default constructor.
*
* You should normall use self() instead.
*/
explicit ToolTipManager(QObject *parent = 0);
/**
* Default destructor.
*/
~ToolTipManager();
/**
* Show the tooltip for a widget registered in the tooltip manager
*
@ -124,7 +112,7 @@ public:
* @return true if the tooltip of the widget is currently displayed,
* false if not
*/
bool isWidgetToolTipDisplayed(QGraphicsWidget *widget);
bool isToolTipVisible(QGraphicsWidget *widget) const;
/**
* Hides the currently showing tooltip after a short amount of time.
@ -179,35 +167,19 @@ public:
*/
void setToolTipContent(QGraphicsWidget *widget, const ToolTipContent &data);
/**
* Clears the tooltip data associated with this widget, but keeps
* the widget registered.
*/
void clearToolTipContent(QGraphicsWidget *widget);
/**
* Checks whether a widget has a tooltip associated with it.
*
* @param widget the widget to check for an associated tooltip
* @return true if the widget has a tooltip associated,
* false if it does not
*/
bool widgetHasToolTip(QGraphicsWidget *widget) const;
/**
* Enable/or disable a Tooltip, this method is useful is we want
* to have a tooltip activated on demand.
* @param widget the widget to change tooltip behaviour
* @param enable if we need the tooltip or not
*/
void setToolTipActivated(QGraphicsWidget *widget, bool enable);
/**
* Return true is the tooltip will be displayed, false otherwise
*/
bool isToolTipActivated(QGraphicsWidget *widget);
private:
/**
* Default constructor.
*
* You should normall use self() instead.
*/
explicit ToolTipManager(QObject *parent = 0);
/**
* Default destructor.
*/
~ToolTipManager();
friend class ToolTipManagerSingleton;
bool eventFilter(QObject *watched, QEvent *event);