Results 1 to 2 of 2

Thread: QGraphicsPolygonItem Points

  1. #1
    Join Date
    Jan 2011
    Qt products
    Unix/X11 Windows

    Default QGraphicsPolygonItem Points


    how do I get the corner points of a given QGraphicsPolygonItem? I couldn't find anything in the documentation.


  2. #2
    Join Date
    Jan 2012
    Thanked 2 Times in 2 Posts

    Default Re: QGraphicsPolygonItem Points

    I'm not sure what you mean exactly by "corner" points, but you could call QGraphicsPolygonItem::polygon() to get the QPolygonF. Since QPolygonF inherits from QVector<QPointF>, you can use any member functions of QVector to access the points in the polygon. For example:

    Qt Code:
    1. foreach(QPointF point, yourPolygonItem->polygon())
    2. {
    3. // do stuff to each point
    4. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Restrict Boundary for QGraphicsPolygonItem
    By sean.reynolds in forum Newbie
    Replies: 1
    Last Post: 10th April 2011, 12:07
  2. QGraphicsRectItem vs QGraphicsPolygonItem
    By Doru in forum Qt Programming
    Replies: 0
    Last Post: 26th January 2011, 07:12
  3. QGraphicsPolygonItem with holes
    By natnan in forum Qt Programming
    Replies: 0
    Last Post: 2nd August 2010, 09:44
  4. I need help in QGraphicsPolygonItem
    By c_srikanth1984 in forum Qt Programming
    Replies: 0
    Last Post: 15th April 2009, 10:53
  5. QPaintEngine and QGraphicsPolygonItem
    By magland in forum Qt Programming
    Replies: 1
    Last Post: 19th August 2008, 16:03


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.