summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativepainteditem.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativepainteditem.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
index c4f0b86..13d1b61 100644
--- a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
@@ -152,8 +152,6 @@ void QDeclarativePaintedItem::setContentsSize(const QSize &size)
Q_D(QDeclarativePaintedItem);
if (d->contentsSize == size) return;
d->contentsSize = size;
- setImplicitWidth(size.width()*d->contentsScale);
- setImplicitHeight(size.height()*d->contentsScale);
clearCache();
update();
emit contentsSizeChanged();
@@ -170,8 +168,6 @@ void QDeclarativePaintedItem::setContentsScale(qreal scale)
Q_D(QDeclarativePaintedItem);
if (d->contentsScale == scale) return;
d->contentsScale = scale;
- setImplicitWidth(d->contentsSize.width()*scale);
- setImplicitHeight(d->contentsSize.height()*scale);
clearCache();
update();
emit contentsScaleChanged();
@@ -232,6 +228,19 @@ void QDeclarativePaintedItem::setCacheFrozen(bool frozen)
// XXX clear cache?
}
+QRectF QDeclarativePaintedItem::boundingRect() const
+{
+ Q_D(const QDeclarativePaintedItem);
+ qreal w = d->mWidth;
+ QSizeF sz = d->contentsSize * d->contentsScale;
+ if (w < sz.width())
+ w = sz.width();
+ qreal h = d->mHeight;
+ if (h < sz.height())
+ h = sz.height();
+ return QRectF(0.0,0.0,w,h);
+}
+
/*!
\internal
*/