QGraphicsView woes, item position is wrong?!



  • I'm trying to use the QGraphicsView and friends for the first time to create essentially a graph editor. I have subclassed QGraphicsView and have it drawing a grid with lines at every 100 px / 100 scene units.

    Now... I am creating some items with ::pos() = {0, 0}, {0, 100}, etc. However, the items are being drawn 200 px apart (i.e. two grid lines)! I am at a total loss as to why. If I fiddle with the view transform, I can get the grid to change as I would expect, and the item positions change also... but always they are two grid lines apart!

    I am at a loss here why this is happening... can someone help?



  • (er... sorry, should add, this is with Qt 5.3.2)



  • geez... and, answering my own question, apparently every bloody thing about QGraphicsItem is in "item coordinates"... which are translated by ::pos(). Sheesh.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.