PDA

View Full Version : QGraphicsView: Dialog Position Doubt



arjunasd
6th August 2007, 17:40
Hi

I have a QGraphicsView with many QGraphicsItem. When I double click on an item, there is a property dialog that pops out. It works fine except that the position of the dialog is away from the item. I would like to have the dialog just below the item being clicked.

I tried setting the position of the dialog using move(). When I used the view as the parent of the dialog and set the position based on the item's corresponding view position, the dialog is fine when the view is maximized but when the view is reduced to a smaller size I get the dialog outside the view.

I would like to have the dialog pop-up just below the item irrespective of the view size.

can anyone help me with some suggestions?

Thanks
Arjun

marcel
6th August 2007, 17:48
When you receive the double click event, use the QGraphicsSceneMouseEvent::screenPos() and move the dialog relative to that point.

It is not ok to use view coordinates, since they are local to the view and very volatile.

Regards