Results 1 to 2 of 2

Thread: Line up graphicsitems in graphicsview

  1. #1
    Join Date
    Dec 2016
    Posts
    37
    Qt products
    Qt5
    Platforms
    Windows

    Default Line up graphicsitems in graphicsview

    I've got a custom graphics item where I draw rectangles of various sizes. For some reason they don't line up with each other horizontally. The x and y position is set before the graphics item is added to the scene using addItem. I use the same x Value but vary the y value for these shapes. But the second shape is offset from the first one horizontally. So for some reason the x value for the second shape seems different. The pen width is set to 1 before drawing any of the shapes.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Line up graphicsitems in graphicsview

    Are you comparing the correct edge of the rectangle ?
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. Child GraphicsItems Not Getting itemChange()
    By jawbreak in forum Qt Programming
    Replies: 2
    Last Post: 20th October 2010, 02:26
  2. GraphicsItems ignore setPos
    By MisterIKS in forum Qt Programming
    Replies: 1
    Last Post: 17th May 2010, 18:41
  3. move GraphicsItems within a GraphicsScene
    By rambo83 in forum Newbie
    Replies: 7
    Last Post: 4th November 2009, 14:40
  4. Adding millions of GraphicsItems is slow
    By rk123 in forum Qt Programming
    Replies: 1
    Last Post: 28th April 2009, 07:17
  5. GraphicsItems and layouts
    By godmodder in forum Qt Programming
    Replies: 1
    Last Post: 17th November 2008, 08:43

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.