Results 1 to 2 of 2

Thread: How do i get QGraphicsLineItem coordinates?

  1. #1
    Join Date
    Mar 2012
    Posts
    14
    Thanks
    1
    Platforms
    Windows

    Default How do i get QGraphicsLineItem coordinates?

    So I did line->setLine(x1,y1,x2,y2) based on my mouse coordinates..

    after i add the line to the scene..how do i get back their coordinates?

    I had made them selectable and movable so i need to get their new position when i move them around.. (doing some sort of a save and load function)

    so in order to save, i need to get their position (x1,y1,x2,y2), how do i go about doing that?

    using line->pos() always returns me (0, 0)..

    Thanks for the helpp..

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How do i get QGraphicsLineItem coordinates?

    QGraphicsLineItem::line() gives you the underlying line. Should be obvious after that.

  3. The following user says thank you to ChrisW67 for this useful post:

    chaltier (2nd April 2012)

Similar Threads

  1. Rotating a QGraphicsLineItem in a QGraphicsScene
    By lxman in forum Qt Programming
    Replies: 34
    Last Post: 2nd April 2014, 19:30
  2. QGraphicsLineItem - selection style
    By stefan in forum Qt Programming
    Replies: 5
    Last Post: 29th November 2010, 09:02
  3. Replies: 4
    Last Post: 18th March 2010, 10:11
  4. A Object inheriting from QGraphicsLineItem
    By jano_alex_es in forum Newbie
    Replies: 15
    Last Post: 15th July 2009, 09:25
  5. QGraphicsLineItem + setAcceptHoverEvents
    By NoRulez in forum Qt Programming
    Replies: 2
    Last Post: 13th May 2008, 12:13

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.