set a tooltip only when the main text is elided

BUG: 189716

svn path=/trunk/KDE/kdelibs/; revision=964973
This commit is contained in:
Marco Martin 2009-05-07 18:49:22 +00:00
parent 359dc82a14
commit 92b51d7751

View File

@ -738,9 +738,13 @@ QSizeF IconWidgetPrivate::layoutText(QTextLayout &layout, const QStyleOptionGrap
const QSizeF size = layoutText(layout, text, constraints.width());
if (size.width() > constraints.width() || size.height() > constraints.height()) {
if (action) {
q->setToolTip(action->text());
}
const QString elided = elidedText(layout, option, constraints);
return layoutText(layout, elided, constraints.width());
}
q->setToolTip(QString());
return size;
}