diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-03-04 23:46:34 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-03-04 23:46:34 (GMT) |
commit | 81952293be3328dc2f62f557478042d1e8d04e0d (patch) | |
tree | f1d12875e61e6a530bb0f3abfde1e8e07203780c /tests/auto/declarative/qdeclarativeitem/data | |
parent | 564baee7e729f1c6f766cecabc4fcc62291e0d0f (diff) | |
download | Qt-81952293be3328dc2f62f557478042d1e8d04e0d.zip Qt-81952293be3328dc2f62f557478042d1e8d04e0d.tar.gz Qt-81952293be3328dc2f62f557478042d1e8d04e0d.tar.bz2 |
Add mapFromItem() and mapToItem() in QDeclarativeItem.
Task-number: QT-2385
Diffstat (limited to 'tests/auto/declarative/qdeclarativeitem/data')
-rw-r--r-- | tests/auto/declarative/qdeclarativeitem/data/mapCoordinates.qml | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeitem/data/mapCoordinates.qml b/tests/auto/declarative/qdeclarativeitem/data/mapCoordinates.qml new file mode 100644 index 0000000..40a2106 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeitem/data/mapCoordinates.qml @@ -0,0 +1,43 @@ +import Qt 4.6 + +Item { + id: root; objectName: "root" + width: 200; height: 200 + + Item { id: itemA; objectName: "itemA"; x: 50; y: 50 } + + Item { + x: 50; y: 50 + Item { id: itemB; objectName: "itemB"; x: 100; y: 100 } + } + + function mapAToB(x, y) { + var pos = itemA.mapToItem(itemB, x, y) + return Qt.point(pos.x, pos.y) + } + + function mapAFromB(x, y) { + var pos = itemA.mapFromItem(itemB, x, y) + return Qt.point(pos.x, pos.y) + } + + function mapAToNull(x, y) { + var pos = itemA.mapToItem(null, x, y) + return Qt.point(pos.x, pos.y) + } + + function mapAFromNull(x, y) { + var pos = itemA.mapFromItem(null, x, y) + return Qt.point(pos.x, pos.y) + } + + function checkMapAToInvalid(x, y) { + var pos = itemA.mapToItem(1122, x, y) + return pos.x == undefined && pos.y == undefined + } + + function checkMapAFromInvalid(x, y) { + var pos = itemA.mapFromItem(1122, x, y) + return pos.x == undefined && pos.y == undefined + } +} |