Hey Guys,
I am using a GraphicsView with a GraphicsScene which i added a PixmapItem....
The QGraphicsPixmapItem is treated as my background item on Z-value "0" on Z-value "1" i have several other pixmapItems.
My Problem:
When i resize the whole program the QGraphicsView also resizes and so the Background item should be resized (what works fine) - it is just a *.scaled() Pixmap where scaled() gets the current size of the GraphicsView.
Now i have to reposition the items on Z-value "1" to match the "same" position as before on the underlaying pixmap
My current Solution:
My current solution is not correct becauze the repositioning does "not work" - it's not exact .. (for the Background PixmapItem i used Qt::KeepAspectRatio)
I saved the original size of the background Pixmap and the position of each Item for that "base size"
On resizing i calculate the new x and y coordinates by referring to the old width/height of the Background Pixmap
This means:
NewWidth/oldWidth * oldX-Coordinate = NewX-Coordinate
NewHeight/oldHeight * oldY-Coordinate = NewY-Coordinate
Anyway .. it's "kinda" working but not exact (i thought it would work better that way ^^)
Anybody an idea how it is possible to calculate that more precisely?? - Would be really lovely
Thanks =)
Bookmarks