Results 1 to 4 of 4

Thread: Drawing QGraphicsSvgItem from center

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2008
    Location
    Norway
    Posts
    7
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Drawing QGraphicsSvgItem from center

    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.
    Attached Images Attached Images

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.