diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-11-03 14:34:43 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-11-10 14:53:34 +0000 |
commit | 8161a92b5fe1c0e4818a0fb19ed2177d7a12f731 (patch) | |
tree | 9221973be79f94848a583d89c08be0c9320c57e5 /tests | |
parent | 08a9fc04989aa05d4cc8c44430977d23cc729656 (diff) |
Quick: Do not calculate the difference in a geometryChange
This difference is only used by the ListView, so calculating it and
storing it (on the stack) introduces a penalty for all items. As the new
geometry is already applied, the old geometry is passed along. This has
the added advantage that the ListView does not have to re-calculate that
either. This fixes a performance regression.
Change-Id: Id5e67bb663a5b11a55ec15ff24ca5b213d1fcef5
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquickitem2/tst_qquickitem.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index 6554d749dd..78322b44a1 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -2726,9 +2726,9 @@ struct TestListener : public QQuickItemChangeListener { TestListener(bool remove = false) : remove(remove) { } - void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange, const QRectF &diff) override + void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange, const QRectF &oldGeometry) override { - record(item, QQuickItemPrivate::Geometry, diff); + record(item, QQuickItemPrivate::Geometry, oldGeometry); } void itemSiblingOrderChanged(QQuickItem *item) override { @@ -2810,20 +2810,20 @@ void tst_QQuickItem::changeListener() item->setImplicitWidth(10); QCOMPARE(itemListener.count(QQuickItemPrivate::ImplicitWidth), 1); QCOMPARE(itemListener.count(QQuickItemPrivate::Geometry), 1); - QCOMPARE(itemListener.value(QQuickItemPrivate::Geometry), QVariant(QRectF(0,0,10,0))); + QCOMPARE(itemListener.value(QQuickItemPrivate::Geometry), QVariant(QRectF(0,0,0,0))); item->setImplicitHeight(20); QCOMPARE(itemListener.count(QQuickItemPrivate::ImplicitHeight), 1); QCOMPARE(itemListener.count(QQuickItemPrivate::Geometry), 2); - QCOMPARE(itemListener.value(QQuickItemPrivate::Geometry), QVariant(QRectF(0,0,0,20))); + QCOMPARE(itemListener.value(QQuickItemPrivate::Geometry), QVariant(QRectF(0,0,10,0))); item->setWidth(item->width() + 30); QCOMPARE(itemListener.count(QQuickItemPrivate::Geometry), 3); - QCOMPARE(itemListener.value(QQuickItemPrivate::Geometry), QVariant(QRectF(0,0,30,0))); + QCOMPARE(itemListener.value(QQuickItemPrivate::Geometry), QVariant(QRectF(0,0,10,20))); item->setHeight(item->height() + 40); QCOMPARE(itemListener.count(QQuickItemPrivate::Geometry), 4); - QCOMPARE(itemListener.value(QQuickItemPrivate::Geometry), QVariant(QRectF(0,0,0,40))); + QCOMPARE(itemListener.value(QQuickItemPrivate::Geometry), QVariant(QRectF(0,0,40,20))); item->setOpacity(0.5); QCOMPARE(itemListener.count(QQuickItemPrivate::Opacity), 1); |