Results 1 to 3 of 3

Thread: possibility of drawing a polygon with the mouse to save a pattern

  1. #1
    Join Date
    Jun 2019
    Location
    France, Pau
    Posts
    60
    Thanks
    30
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Question possibility of drawing a polygon with the mouse to save a pattern

    Hello,

    Is it feasible to draw a polygon around a Qwt line curve with the mouse ? Because I want to save the polygon points (the scale values not the pixels) and be able later to load them and draw them in order to validate if a line curve fits inside the polygon points (both visually and programmatically : true/false).

    If someone has already done this or has a better idea to validate if data fits within some borders (defined by a polygon), I'll take it.

    Thanks.

  2. #2
    Join Date
    Jun 2019
    Location
    France, Pau
    Posts
    60
    Thanks
    30
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: possibility of drawing a polygon with the mouse to save a pattern

    OK, I found how to do it, I will share my solution once I finish it.

  3. #3
    Join Date
    Jun 2019
    Location
    France, Pau
    Posts
    60
    Thanks
    30
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: possibility of drawing a polygon with the mouse to save a pattern

    This thread https://www.qtcentre.org/threads/512...use-on-qwtpolt gave me insights. I don't really have time to post my solution. In short use a polygonal picker, after drawing the polygon, this last can send you the points via a signal. Then just store these points (with the proper transformation to axis values) in QPolygonF and feed this last to a QPainterPath. Create a QwtPlotShapeItem and use the QPainterPath to define its shape.

Similar Threads

  1. Replies: 0
    Last Post: 1st April 2016, 12:17
  2. Drawing polygon using event filter in Qt
    By benz6699 in forum Qt Programming
    Replies: 4
    Last Post: 19th September 2014, 08:55
  3. Strange whiskers when drawing a polygon
    By feraudyh in forum Newbie
    Replies: 0
    Last Post: 22nd November 2009, 16:20
  4. Replies: 3
    Last Post: 3rd March 2009, 12:24
  5. Optimizing polygon clipping in QGraphicsScene drawing
    By maverick_pol in forum Qt Programming
    Replies: 1
    Last Post: 28th September 2008, 20:41

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.