use the resize event

svn path=/trunk/KDE/kdelibs/; revision=1017755
This commit is contained in:
Aaron J. Seigo 2009-08-31 11:35:37 +00:00
parent a36b7045f9
commit b4fa1b3859
2 changed files with 10 additions and 4 deletions

View File

@ -163,6 +163,11 @@ bool ItemBackground::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
return false; return false;
} }
void ItemBackground::resizeEvent(QGraphicsSceneResizeEvent *)
{
d->frameSvg->resizeFrame(size());
}
QVariant ItemBackground::itemChange(GraphicsItemChange change, const QVariant &value) QVariant ItemBackground::itemChange(GraphicsItemChange change, const QVariant &value)
{ {
if (d->immediate) { if (d->immediate) {
@ -193,10 +198,6 @@ void ItemBackground::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
{ {
Q_UNUSED(widget) Q_UNUSED(widget)
if (d->frameSvg->frameSize() != option->rect.size()) {
d->frameSvg->resizeFrame(option->rect.size());
}
if (qFuzzyCompare(d->opacity, (qreal)1.0)) { if (qFuzzyCompare(d->opacity, (qreal)1.0)) {
d->frameSvg->paintFrame(painter, option->rect.topLeft()); d->frameSvg->paintFrame(painter, option->rect.topLeft());
} else if (qFuzzyCompare(d->opacity+1, (qreal)1.0)) { } else if (qFuzzyCompare(d->opacity+1, (qreal)1.0)) {

View File

@ -72,6 +72,11 @@ protected:
*/ */
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event); bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
/**
* @reimp from QGraphicsItem
*/
void resizeEvent(QGraphicsSceneResizeEvent *);
private: private:
Q_PRIVATE_SLOT(d, void animationUpdate(qreal progress)) Q_PRIVATE_SLOT(d, void animationUpdate(qreal progress))
Q_PRIVATE_SLOT(d, void targetDestroyed(QObject*)) Q_PRIVATE_SLOT(d, void targetDestroyed(QObject*))