summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-11-04 03:00:50 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-11-04 03:00:50 (GMT)
commitf1344a817fdb3d263bd64f4440fedc73ad94ad31 (patch)
tree2c994ffa7eb940319b468cacf2ecc20525e5cdaa
parent5ab0ad47ba216c851c21d7fee73a69d2a793ea65 (diff)
downloadQt-f1344a817fdb3d263bd64f4440fedc73ad94ad31.zip
Qt-f1344a817fdb3d263bd64f4440fedc73ad94ad31.tar.gz
Qt-f1344a817fdb3d263bd64f4440fedc73ad94ad31.tar.bz2
Don't emit xChanged()/yChanged() twice.
Once from QGraphicsObject (QGraphicsItemPrivate::setPosHelper()) and once from QDeclarativeItem::geometryChanged(). Remove from geometryChanged(). Task-number: QTBUG-14942 Reviewed-by: Michael Brasser
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp10
2 files changed, 10 insertions, 4 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 95a4fd6..e0df751 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -1955,12 +1955,8 @@ void QDeclarativeItem::geometryChanged(const QRectF &newGeometry,
change.listener->itemGeometryChanged(this, newGeometry, oldGeometry);
}
- if (newGeometry.x() != oldGeometry.x())
- emit xChanged();
if (newGeometry.width() != oldGeometry.width())
emit widthChanged();
- if (newGeometry.y() != oldGeometry.y())
- emit yChanged();
if (newGeometry.height() != oldGeometry.height())
emit heightChanged();
}
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
index b4903ae..711bf00 100644
--- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
+++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
@@ -686,6 +686,8 @@ void tst_QDeclarativeItem::propertyChanges()
QSignalSpy focusSpy(item, SIGNAL(focusChanged(bool)));
QSignalSpy wantsFocusSpy(parentItem, SIGNAL(activeFocusChanged(bool)));
QSignalSpy childrenChangedSpy(parentItem, SIGNAL(childrenChanged()));
+ QSignalSpy xSpy(item, SIGNAL(xChanged()));
+ QSignalSpy ySpy(item, SIGNAL(yChanged()));
item->setParentItem(parentItem);
item->setWidth(100.0);
@@ -731,6 +733,14 @@ void tst_QDeclarativeItem::propertyChanges()
QCOMPARE(parentItem->hasFocus(), false);
QCOMPARE(wantsFocusSpy.count(),0);
+ item->setX(10.0);
+ QCOMPARE(item->x(), 10.0);
+ QCOMPARE(xSpy.count(), 1);
+
+ item->setY(10.0);
+ QCOMPARE(item->y(), 10.0);
+ QCOMPARE(ySpy.count(), 1);
+
delete canvas;
}