PDA

View Full Version : itemAt(position,QTransform & deviceTransform) below qt 4.6



sanku
15th February 2011, 09:52
I want to know what is alternative for scene.itemAt(position,QTransform & deviceTransform) for older version of Qt below 4.6,
deviceTransform to be provided if the scene contains items that ignore transformations.

In my code, I have few qgraphicstext which are place on qgraphicsscene -> qgraphicsview.
I have subclass QGraphicsText and reimplementing mouseEvents for textitem which emit a signal about textitem's position change at mouseMovementEvent
and also subclass QGraphicsView for rubberband effect for zoom-in of selected area in View.

I have set flag for textitem to ItemIgnoresTransformations and now if I zoomout my view below 50% then if I click on a textitem then it doesn't pick the correct text in otherwords my mouse event pos even after maptoScene doesn't give correct co-ordinates which in turn my, scene.itemAt(mapToScene(event.pos()) pickes a different point.
But works fine if I provide deviceTransform to itemAt then it works like a charm,

But I am worried about qt version below 4.6, at this point if I tried to move a textitem when I zoom out, along with moving the textitem it also zoom's in

I have attaching python file below,
after running the program with minus key reduce the view below 50% and try to move the qgraphicstextitem, itemAt returns a different textitem or None, But comment line 53-59 and uncomment line 60-66 try the same and it works

Any help

Thank you in advance

sanku
18th February 2011, 18:25
Anybody? No one has encounter this problem?