[Qt-interest] Getting Coordinates of QGraphicsItem in absolute terms of another

Michael Jackson mike.jackson at bluequartz.net
Fri Oct 29 17:13:56 CEST 2010


I am displaying a QGraphicsView with a QGraphicsScene. Pretty basic stuff. I
load up an image (Tiff: 1286x955 pixels w x h) and then allow the user to
create a "selection" area using a combination of QRubberBand and a
QGraphicsPolygonItem derived item. This all shows up just fine. I can select
the "selection area" and move it around. I can resize it just fine. What I
would like to do is show in the user interface (a QTableView to be precise)
the upper left corner coordinates (in pixel coordinates) of that "selection
area". I have all the signals/slots hooked up. I have a custom table model
ready to go. The problem is that the values I get for things like the
boundingRect seem relative to the initial position that the "selection area"
was generated at? I have tried mapToScene, mapfromScene, mapToParent,
mapFromParent and a few others but nothing is really making sense.
  A gently push in a direction would be greatly appreciated.

Also been through Summerfield's book which was some help in initially
getting all of this working.

Thanks for any help
---
Mike Jackson   www.bluequartz.net
 




More information about the Qt-interest-old mailing list