From ea41519c3c8f8e26e0b6dbc9224dc730be015c3f Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Tue, 30 Dec 2008 02:04:35 +0000 Subject: [PATCH] this is much clearer, does the same thing and has the benefit of being able to pre-emptively hide the tip in toolTipAboutToShow! svn path=/trunk/KDE/kdelibs/; revision=903158 --- private/tooltip.cpp | 6 +----- private/tooltip_p.h | 2 +- tooltipmanager.cpp | 23 ++++------------------- 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/private/tooltip.cpp b/private/tooltip.cpp index 21d28c355..81a767e07 100644 --- a/private/tooltip.cpp +++ b/private/tooltip.cpp @@ -241,12 +241,8 @@ void ToolTip::setContent(QObject *tipper, const ToolTipContent &data) } } -void ToolTip::prepareShowing(bool cueUpdate) +void ToolTip::prepareShowing() { - if (cueUpdate && d->source) { - QMetaObject::invokeMethod(d->source, "toolTipAboutToShow"); - } - if (d->preview->windowId() != 0) { // show/hide the preview area d->preview->show(); diff --git a/private/tooltip_p.h b/private/tooltip_p.h index 5346a54dd..78c86726b 100644 --- a/private/tooltip_p.h +++ b/private/tooltip_p.h @@ -38,7 +38,7 @@ public: ~ToolTip(); void setContent(QObject *tipper, const ToolTipContent &data); - void prepareShowing(bool cueUpdate); + void prepareShowing(); void moveTo(const QPoint &to); bool autohide() const; void setDirection(Plasma::Direction); diff --git a/tooltipmanager.cpp b/tooltipmanager.cpp index 466d5b5b3..3ed192a8f 100644 --- a/tooltipmanager.cpp +++ b/tooltipmanager.cpp @@ -300,36 +300,21 @@ void ToolTipManagerPrivate::showToolTip() return; } + QMetaObject::invokeMethod(currentWidget, "toolTipAboutToShow"); QHash::const_iterator tooltip = tooltips.constFind(currentWidget); - if (tooltip == tooltips.constEnd()) { + if (tooltip == tooltips.constEnd() || tooltip.value().isEmpty()) { return; } - bool justCreated = false; - - if (tooltip.value().isEmpty()) { - // give the object a chance for delayed loading of the tip - QMetaObject::invokeMethod(currentWidget, "toolTipAboutToShow"); - tooltip = tooltips.constFind(currentWidget); - //kDebug() << "attempt to make one ... we gots" << tooltip.isEmpty(); - - if (tooltip == tooltips.constEnd() || tooltip.value().isEmpty()) { - currentWidget = 0; - return; - } - - justCreated = true; - } - Containment *c = dynamic_cast(currentWidget->topLevelItem()); - kDebug() << "about to show" << justCreated << (QObject*)c; + //kDebug() << "about to show" << (QObject*)c; if (c) { tipWidget->setDirection(Plasma::locationToDirection(c->location())); } tipWidget->setContent(currentWidget, tooltip.value()); - tipWidget->prepareShowing(!justCreated); + tipWidget->prepareShowing(); tipWidget->moveTo(ToolTipManager::self()->m_corona->popupPosition(currentWidget, tipWidget->size())); tipWidget->show(); isShown = true; //ToolTip is visible