Mhondoz
14th March 2008, 13:34
Hi.
I have an application using QGraphicsView, where I can click in the view to add an SVG item. I want this item to be drawn with the center of the image at the position I click. Right now I get the scene position from the click, and set that as the new items position, but then the item seem to be drawn with this position as its upper left corner...
Is it something I can do in the SVG file (for example using Inkscape) to let the svg items position be the center of the image, or in the paint method of the item perhaps?
I guess I could calculate some offset based on the image size and adjust the position based on that, but I hope to avoid that solutions since I would like the item->pos() to represent the actual position.
I have an application using QGraphicsView, where I can click in the view to add an SVG item. I want this item to be drawn with the center of the image at the position I click. Right now I get the scene position from the click, and set that as the new items position, but then the item seem to be drawn with this position as its upper left corner...
Is it something I can do in the SVG file (for example using Inkscape) to let the svg items position be the center of the image, or in the paint method of the item perhaps?
I guess I could calculate some offset based on the image size and adjust the position based on that, but I hope to avoid that solutions since I would like the item->pos() to represent the actual position.