add a sensible size hint

svn path=/trunk/KDE/kdelibs/; revision=1005675
This commit is contained in:
Marco Martin 2009-08-01 18:36:01 +00:00
parent 02e6870f4e
commit c6bab8100d
2 changed files with 10 additions and 0 deletions

View File

@ -96,6 +96,15 @@ void SvgWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
}
}
QSizeF SvgWidget::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
{
if (d->svg && which == Qt::PreferredSize) {
return d->svg->size();
} else {
return QGraphicsWidget::sizeHint(which, constraint);
}
}
} // Plasma namespace
#include "svgwidget.moc"

View File

@ -58,6 +58,7 @@ class PLASMA_EXPORT SvgWidget : public QGraphicsWidget
protected:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint) const;
private:
SvgWidgetPrivate * const d;