some tooltip regression fixes from moving to QTextDocument; as an added bonus we don't copy the tooltip content anymore!

svn path=/trunk/KDE/kdelibs/; revision=884063
This commit is contained in:
Aaron J. Seigo 2008-11-14 06:06:15 +00:00
parent 2de1e10c67
commit 18885bd0f0
2 changed files with 15 additions and 9 deletions

View File

@ -52,9 +52,9 @@ public:
document(new QTextDocument(this))
{
//d->text->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
QTextOption op;
op.setWrapMode(QTextOption::WordWrap);
document->setDefaultTextOption(op);
// QTextOption op;
// op.setWrapMode(QTextOption::WordWrap);
// document->setDefaultTextOption(op);
}
void setStyleSheet(const QString &css)
@ -68,6 +68,7 @@ public:
data.registerResources(document);
document->setHtml("<p><b>" + data.mainText() + "</b><br>" + data.subText() + "</p>");
document->adjustSize();
update();
}
QSize minimumSizeHint() const

View File

@ -292,16 +292,21 @@ void ToolTipManagerPrivate::showToolTip()
return;
}
ToolTipContent tooltip = tooltips.value(currentWidget);
QHash<QGraphicsWidget *, ToolTipContent>::const_iterator tooltip = tooltips.constFind(currentWidget);
if (tooltip == tooltips.constEnd()) {
return;
}
bool justCreated = false;
if (tooltip.isEmpty()) {
if (tooltip.value().isEmpty()) {
// give the object a chance for delayed loading of the tip
QMetaObject::invokeMethod(currentWidget, "toolTipAboutToShow");
tooltip = tooltips.value(currentWidget);
tooltip = tooltips.constFind(currentWidget);
//kDebug() << "attempt to make one ... we gots" << tooltip.isEmpty();
if (tooltip.isEmpty()) {
if (tooltip.value().isEmpty()) {
currentWidget = 0;
return;
}
@ -310,13 +315,13 @@ void ToolTipManagerPrivate::showToolTip()
}
//kDebug() << "about to show" << justCreated;
tipWidget->setContent(currentWidget,tooltip);
tipWidget->setContent(currentWidget, tooltip.value());
tipWidget->prepareShowing(!justCreated);
tipWidget->moveTo(ToolTipManager::self()->m_corona->popupPosition(currentWidget, tipWidget->size()));
tipWidget->show();
isShown = true; //ToolTip is visible
delayedHide = tooltip.autohide();
delayedHide = tooltip.value().autohide();
if (delayedHide) {
//kDebug() << "starting authoide";
hideTimer->start(3000);