try to be more strict when the policy is fixed:

the minimum and the preferred size are the same (i.e. avoid to cut away text, always)

svn path=/trunk/KDE/kdelibs/; revision=1125673
This commit is contained in:
Marco Martin 2010-05-11 22:06:17 +00:00
parent fe9e96f8bf
commit 4ab87220a3
2 changed files with 10 additions and 0 deletions

View File

@ -363,6 +363,15 @@ QVariant Label::itemChange(GraphicsItemChange change, const QVariant & value)
return QGraphicsWidget::itemChange(change, value);
}
QSizeF Label::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
{
if (sizePolicy().verticalPolicy() == QSizePolicy::Fixed) {
return QGraphicsProxyWidget::sizeHint(Qt::PreferredSize, constraint);
} else {
return QGraphicsProxyWidget::sizeHint(which, constraint);
}
}
} // namespace Plasma
#include <label.moc>

View File

@ -171,6 +171,7 @@ protected:
bool event(QEvent *event);
QVariant itemChange(GraphicsItemChange change, const QVariant & value);
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
private:
Q_PRIVATE_SLOT(d, void setPalette())