summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-05-04 05:13:59 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-05-04 05:13:59 (GMT)
commita5aadcea4c12c7926bf3b4d218ce476723cd7e10 (patch)
tree8eb1a23c5b1c824701e31b4ce7b556a4d1c63f9a /src/declarative/graphicsitems/qdeclarativepainteditem.cpp
parent1e3a6ac738b54c4ea3652b9f6ede665a1fafc72c (diff)
downloadQt-a5aadcea4c12c7926bf3b4d218ce476723cd7e10.zip
Qt-a5aadcea4c12c7926bf3b4d218ce476723cd7e10.tar.gz
Qt-a5aadcea4c12c7926bf3b4d218ce476723cd7e10.tar.bz2
Optimization for QDeclarativePaintedItem.
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativepainteditem.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativepainteditem.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
index f52636f..5dd7e5d 100644
--- a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
@@ -59,8 +59,8 @@ QT_BEGIN_NAMESPACE
\brief The QDeclarativePaintedItem class is an abstract base class for QDeclarativeView items that want cached painting.
\internal
- This is a convenience class for implementing items that paint their contents
- using a QPainter. The contents of the item are cached behind the scenes.
+ This is a convenience class for implementing items that cache their painting.
+ The contents of the item are cached behind the scenes.
The dirtyCache() function should be called if the contents change to
ensure the cache is refreshed the next time painting occurs.
@@ -184,7 +184,6 @@ void QDeclarativePaintedItem::setContentsScale(qreal scale)
QDeclarativePaintedItem::QDeclarativePaintedItem(QDeclarativeItem *parent)
: QDeclarativeItem(*(new QDeclarativePaintedItemPrivate), parent)
{
- init();
}
/*!
@@ -195,7 +194,6 @@ QDeclarativePaintedItem::QDeclarativePaintedItem(QDeclarativeItem *parent)
QDeclarativePaintedItem::QDeclarativePaintedItem(QDeclarativePaintedItemPrivate &dd, QDeclarativeItem *parent)
: QDeclarativeItem(dd, parent)
{
- init();
}
/*!
@@ -206,14 +204,21 @@ QDeclarativePaintedItem::~QDeclarativePaintedItem()
clearCache();
}
-/*!
- \internal
-*/
-void QDeclarativePaintedItem::init()
+void QDeclarativePaintedItem::geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry)
{
- connect(this,SIGNAL(widthChanged()),this,SLOT(clearCache()));
- connect(this,SIGNAL(heightChanged()),this,SLOT(clearCache()));
- connect(this,SIGNAL(visibleChanged()),this,SLOT(clearCache()));
+ if (newGeometry.width() != oldGeometry.width() ||
+ newGeometry.height() != oldGeometry.height())
+ clearCache();
+}
+
+QVariant QDeclarativePaintedItem::itemChange(GraphicsItemChange change,
+ const QVariant &value)
+{
+ if (change == ItemVisibleHasChanged)
+ clearCache();
+
+ return QDeclarativeItem::itemChange(change, value);
}
void QDeclarativePaintedItem::setCacheFrozen(bool frozen)