[Qt-qml] Finding the coordinates of an item in a (Grid)View

Pertti Kellomäki pertti.kellomaki at nokia.com
Thu Oct 21 11:37:50 CEST 2010


I have a small problem, maybe someone on the list can help.

I have an application with two views. In the first view, there are a 
number of items displayed in a GridView. In the second view there is 
just one item with some text beside it. What I am trying to accomplish 
is a smooth transition between two views. When an item is clicked in the 
first view, the selected item should slide to the left, and the rest of 
the items should fade away.

The attached files contain a minimal implementation I have come up with. 
The only problem is that I cannot figure out how to start the animation 
of the selected item in the correct place, as indicated in the onClicked 
handler in the code. In other words, I need to find the coordinates of 
the selected item in the application's coordinate system. It seems that 
Item::mapToItem() should do the job, but I have not found a way to use 
it from QML without going via C++.

It is certainly possible that there is a much better way to accomplish 
the same effect in QML. If so, please show me the error in my ways.
-- 
Pertti

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: untitled.qmlproject
Url: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20101021/9c0765dd/attachment.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: untitled.qml
Url: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20101021/9c0765dd/attachment-0001.pl 


More information about the Qt-qml mailing list