tell the tooltip widget about the source so it can tel it when it disappears and to prompt it for updates appropriately

svn path=/trunk/KDE/kdelibs/; revision=882588
This commit is contained in:
Aaron J. Seigo 2008-11-10 23:30:19 +00:00
parent b6557d1677
commit e8eb11a3b7
3 changed files with 7 additions and 4 deletions

View File

@ -146,13 +146,14 @@ void ToolTip::checkSize()
}
}
void ToolTip::setContent(const ToolTipContent &data)
void ToolTip::setContent(QObject *tipper, const ToolTipContent &data)
{
//reset our size
d->label->setText("<qt><b>" + data.mainText() + "</b><br>" + data.subText() + "</qt>");
d->imageLabel->setPixmap(data.image());
d->preview->setWindowId(data.windowToPreview());
d->autohide = data.autohide();
d->source = tipper;
if (isVisible()) {
d->preview->setInfo();

View File

@ -37,7 +37,7 @@ public:
ToolTip(QWidget *parent);
~ToolTip();
void setContent(const ToolTipContent &data);
void setContent(QObject *tipper, const ToolTipContent &data);
void prepareShowing(bool cueUpdate);
void moveTo(const QPoint &to);
bool autohide() const;

View File

@ -209,7 +209,7 @@ void ToolTipManager::setContent(QGraphicsWidget *widget, const ToolTipContent &d
hide(widget);
}
d->tipWidget->setContent(data);
d->tipWidget->setContent(widget, data);
}
}
@ -255,6 +255,8 @@ void ToolTipManagerPrivate::onWidgetDestroyed(QObject *object)
QGraphicsWidget *w = static_cast<QGraphicsWidget*>(object);
if (currentWidget == w) {
tipWidget->setContent(0, ToolTipContent());
tipWidget->hide();
currentWidget = 0;
showTimer->stop(); // stop the timer to show the tooltip
delayedHide = false;
@ -308,7 +310,7 @@ void ToolTipManagerPrivate::showToolTip()
}
//kDebug() << "about to show" << justCreated;
tipWidget->setContent(tooltip);
tipWidget->setContent(currentWidget,tooltip);
tipWidget->prepareShowing(!justCreated);
tipWidget->moveTo(ToolTipManager::self()->m_corona->popupPosition(currentWidget, tipWidget->size()));
tipWidget->show();