Hi,
I have an item which resides in an item group. Note that I did;
setHandlesChildEvents(TRUE)
setHandlesChildEvents(TRUE)
To copy to clipboard, switch view to plain text mode
.
When I move my item by the cursor(drag-drop), I want to see, update and maintain it's position. But here are the problems...
1. When I print out the item's position in item group like ;
cout<<"Position of item , x-coordinate: "<<item->pos().x()<<endl;
cout<<"Position of item , y-coordinate: "<<item->pos().y()<<endl
cout<<"Position of item , x-coordinate: "<<item->pos().x()<<endl;
cout<<"Position of item , y-coordinate: "<<item->pos().y()<<endl
To copy to clipboard, switch view to plain text mode
it gives me a pair of (0,0). Isn't that odd?
2. When I print out the item group's coordinates like;
cout<<"Position of item , x-coordinate: "<<pos().x()<<endl;
cout<<"Position of item , y-coordinate: "<<pos().y()<<endl
cout<<"Position of item , x-coordinate: "<<pos().x()<<endl;
cout<<"Position of item , y-coordinate: "<<pos().y()<<endl
To copy to clipboard, switch view to plain text mode
it gives me the values in local coordinates. How can I convert these to scene coordinates? mapToScene(pos()) gives the same result by the way!
Bookmarks