diff --git a/widgets/itembackground.cpp b/widgets/itembackground.cpp index 3b038a7be..26c64e60d 100644 --- a/widgets/itembackground.cpp +++ b/widgets/itembackground.cpp @@ -163,6 +163,11 @@ bool ItemBackground::sceneEventFilter(QGraphicsItem *watched, QEvent *event) return false; } +void ItemBackground::resizeEvent(QGraphicsSceneResizeEvent *) +{ + d->frameSvg->resizeFrame(size()); +} + QVariant ItemBackground::itemChange(GraphicsItemChange change, const QVariant &value) { if (d->immediate) { @@ -193,10 +198,6 @@ void ItemBackground::paint(QPainter *painter, const QStyleOptionGraphicsItem *op { Q_UNUSED(widget) - if (d->frameSvg->frameSize() != option->rect.size()) { - d->frameSvg->resizeFrame(option->rect.size()); - } - if (qFuzzyCompare(d->opacity, (qreal)1.0)) { d->frameSvg->paintFrame(painter, option->rect.topLeft()); } else if (qFuzzyCompare(d->opacity+1, (qreal)1.0)) { diff --git a/widgets/itembackground.h b/widgets/itembackground.h index 9ef1b5552..1f83345b1 100644 --- a/widgets/itembackground.h +++ b/widgets/itembackground.h @@ -72,6 +72,11 @@ protected: */ bool sceneEventFilter(QGraphicsItem *watched, QEvent *event); + /** + * @reimp from QGraphicsItem + */ + void resizeEvent(QGraphicsSceneResizeEvent *); + private: Q_PRIVATE_SLOT(d, void animationUpdate(qreal progress)) Q_PRIVATE_SLOT(d, void targetDestroyed(QObject*))