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:
parent
b6557d1677
commit
e8eb11a3b7
@ -146,13 +146,14 @@ void ToolTip::checkSize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolTip::setContent(const ToolTipContent &data)
|
void ToolTip::setContent(QObject *tipper, const ToolTipContent &data)
|
||||||
{
|
{
|
||||||
//reset our size
|
//reset our size
|
||||||
d->label->setText("<qt><b>" + data.mainText() + "</b><br>" + data.subText() + "</qt>");
|
d->label->setText("<qt><b>" + data.mainText() + "</b><br>" + data.subText() + "</qt>");
|
||||||
d->imageLabel->setPixmap(data.image());
|
d->imageLabel->setPixmap(data.image());
|
||||||
d->preview->setWindowId(data.windowToPreview());
|
d->preview->setWindowId(data.windowToPreview());
|
||||||
d->autohide = data.autohide();
|
d->autohide = data.autohide();
|
||||||
|
d->source = tipper;
|
||||||
|
|
||||||
if (isVisible()) {
|
if (isVisible()) {
|
||||||
d->preview->setInfo();
|
d->preview->setInfo();
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
ToolTip(QWidget *parent);
|
ToolTip(QWidget *parent);
|
||||||
~ToolTip();
|
~ToolTip();
|
||||||
|
|
||||||
void setContent(const ToolTipContent &data);
|
void setContent(QObject *tipper, const ToolTipContent &data);
|
||||||
void prepareShowing(bool cueUpdate);
|
void prepareShowing(bool cueUpdate);
|
||||||
void moveTo(const QPoint &to);
|
void moveTo(const QPoint &to);
|
||||||
bool autohide() const;
|
bool autohide() const;
|
||||||
|
@ -209,7 +209,7 @@ void ToolTipManager::setContent(QGraphicsWidget *widget, const ToolTipContent &d
|
|||||||
hide(widget);
|
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);
|
QGraphicsWidget *w = static_cast<QGraphicsWidget*>(object);
|
||||||
|
|
||||||
if (currentWidget == w) {
|
if (currentWidget == w) {
|
||||||
|
tipWidget->setContent(0, ToolTipContent());
|
||||||
|
tipWidget->hide();
|
||||||
currentWidget = 0;
|
currentWidget = 0;
|
||||||
showTimer->stop(); // stop the timer to show the tooltip
|
showTimer->stop(); // stop the timer to show the tooltip
|
||||||
delayedHide = false;
|
delayedHide = false;
|
||||||
@ -308,7 +310,7 @@ void ToolTipManagerPrivate::showToolTip()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//kDebug() << "about to show" << justCreated;
|
//kDebug() << "about to show" << justCreated;
|
||||||
tipWidget->setContent(tooltip);
|
tipWidget->setContent(currentWidget,tooltip);
|
||||||
tipWidget->prepareShowing(!justCreated);
|
tipWidget->prepareShowing(!justCreated);
|
||||||
tipWidget->moveTo(ToolTipManager::self()->m_corona->popupPosition(currentWidget, tipWidget->size()));
|
tipWidget->moveTo(ToolTipManager::self()->m_corona->popupPosition(currentWidget, tipWidget->size()));
|
||||||
tipWidget->show();
|
tipWidget->show();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user