Results 1 to 1 of 1

Thread: Problem with QPainterPath

  1. #1
    Join Date
    Aug 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem with QPainterPath

    I used QPainterPath to create a polygon.

    Qt Code:
    1. path.addEllipse(0, 0, 50, 50);
    2. path.closeSubpath();
    3. qDebug() << path.currentPosition();
    4.  
    5. path.moveTo(25, 25);
    6. path.lineTo(25, 40);
    7.  
    8. m_polygon = path.toFillPolygon();
    To copy to clipboard, switch view to plain text mode 

    I want see line in my ellipse, but it seems than method closeSubpath() don't put currentPosition to (0, 0) and qDebug tell me that too. I want draw my line in ellipse without line that move from ellipse to start point of this inner line. Any ideas? Thank you for help!


    Added after 1 36 minutes:


    Even I use QPainterPath Class Reference example I see line from (20, 20) to (0, 0). It seems that path.moveTo(0, 0) draw line.
    Qt Code:
    1. path.addRect(20, 20, 60, 60);
    2.  
    3. path.moveTo(0, 0);
    4. path.cubicTo(99, 0, 50, 50, 99, 99);
    5. path.cubicTo(0, 99, 50, 50, 0, 0);
    6.  
    7. QPainter painter(this);
    8. painter.fillRect(0, 0, 100, 100, Qt::white);
    9. painter.setPen(QPen(QColor(79, 106, 25), 1, Qt::SolidLine,
    10. Qt::FlatCap, Qt::MiterJoin));
    11. painter.setBrush(QColor(122, 163, 39));
    12.  
    13. painter.drawPath(path);
    To copy to clipboard, switch view to plain text mode 
    Last edited by kaktus123; 7th August 2012 at 12:10.

Similar Threads

  1. QPainterPath subtracted problem
    By nightroad in forum Newbie
    Replies: 0
    Last Post: 12th July 2011, 20:16
  2. QPainterPath::quadTo(...) calls QPainterPath::cubicTo(...) ?
    By brucelamond in forum Qt Programming
    Replies: 0
    Last Post: 28th April 2011, 23:30
  3. QPainterPath and moveTo problem
    By allting in forum Qt Programming
    Replies: 3
    Last Post: 15th May 2010, 16:02
  4. Qpen, QBrush or QPainterpath problem
    By jano_alex_es in forum Newbie
    Replies: 2
    Last Post: 14th July 2009, 11:53
  5. QPainterPath drawing problem
    By shad in forum Qt Programming
    Replies: 3
    Last Post: 17th January 2007, 13:30

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.