Results 1 to 1 of 1

Thread: QPainterPath subtracted problem

  1. #1
    Join Date
    Sep 2010
    Posts
    46
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: QPainterPath subtracted problem

    Hi there,

    I'm trouble with QPainterPath::subtracted function, i made a little sample like that

    Qt Code:
    1. path.moveTo(100,200);
    2. path.lineTo(250,200);
    3. path.moveTo(250,200);
    4. path.lineTo(300,200);
    5. painter->drawPath( path );
    6.  
    7. QPainterPath path2;
    8. QPen pen2 ( QBrush(Qt::red), 6 );
    9. painter->setPen( pen2 );
    10. painter->setBrush(brush());
    11. path2.moveTo(120,200);
    12. path2.lineTo(260,200);
    13. painter->drawPath( path2 );
    14.  
    15. QPen pen3 ( QBrush(Qt::green), 3 );
    16. painter->setPen( pen3 );
    17. painter->setBrush(brush());
    18.  
    19. QPainterPath popo = path.subtracted( path2 );
    20.  
    21. if ( popo != path )
    22. painter->drawPath( popo );
    To copy to clipboard, switch view to plain text mode 

    popo is always equal to path ? am i doing something wrong ?


    Added after 49 minutes:


    Oh my mistake, QPainterPath::subtracted is doing fill area's subtraction. Lines don't have filled area at all then it's not working as i expect. Anyway is there any idea how can i subtract which is consisted lines QPainterPath with another QPainterPath which is also consisted lines ..
    Last edited by nightroad; 12th July 2011 at 22:23.

Similar Threads

  1. QPainterPath::quadTo(...) calls QPainterPath::cubicTo(...) ?
    By brucelamond in forum Qt Programming
    Replies: 0
    Last Post: 29th April 2011, 00:30
  2. Error in QPolygonF::subtracted
    By lni in forum Qt Programming
    Replies: 1
    Last Post: 25th June 2010, 02:27
  3. QPainterPath and moveTo problem
    By allting in forum Qt Programming
    Replies: 3
    Last Post: 15th May 2010, 17:02
  4. Qpen, QBrush or QPainterpath problem
    By jano_alex_es in forum Newbie
    Replies: 2
    Last Post: 14th July 2009, 12:53
  5. QPainterPath drawing problem
    By shad in forum Qt Programming
    Replies: 3
    Last Post: 17th January 2007, 14: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
  •  
Qt is a trademark of The Qt Company.