Results 1 to 5 of 5

Thread: QPainterPath -

  1. #1
    Join Date
    Jan 2013
    Posts
    43
    Thanks
    27
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QPainterPath -

    Hi

    Why do i loose fill color after the connectPath?

    Qt Code:
    1. path.moveTo(100, 100);
    2. path.lineTo(100, 200);
    3. path.lineTo(200, 200);
    4. path.lineTo(200, 100);
    5. path.connectPath(path);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QPainterPath -

    Because as a result you get a path equivalent to:

    Qt Code:
    1. path.moveTo(100, 100);
    2. path.lineTo(100, 200);
    3. path.lineTo(200, 200);
    4. path.lineTo(200, 100);
    5. path.lineTo(100,100);
    6. path.lineTo(100, 200);
    7. path.lineTo(200, 200);
    8. path.lineTo(200, 100);
    To copy to clipboard, switch view to plain text mode 
    which is not closed.

    What you probably want is this:

    Qt Code:
    1. path.moveTo(100, 100);
    2. path.lineTo(100, 200);
    3. path.lineTo(200, 200);
    4. path.lineTo(200, 100);
    5. path.closeSubpath();
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    aguleo (17th February 2013)

  4. #3
    Join Date
    Jan 2013
    Posts
    43
    Thanks
    27
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QPainterPath -

    Yeah ... yu read my mind
    Now i have a square.

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QPainterPath -

    Quote Originally Posted by aguleo View Post
    Yeah ... yu read my mind
    Now i have a square.
    BTW.
    Qt Code:
    1. p.addRect(100,100, 100,100);
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    Jan 2013
    Posts
    43
    Thanks
    27
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QPainterPath -

    I know ... just exploring how to close a path.

    I was reading this: http://qt-project.org/doc/qt-4.8/qpa...h.html#cubicTo

    The square was the simplest example that came o my mind.

Similar Threads

  1. QPainterPath::quadTo(...) calls QPainterPath::cubicTo(...) ?
    By brucelamond in forum Qt Programming
    Replies: 0
    Last Post: 28th April 2011, 23:30
  2. QPainterPath and scale()
    By edwardc in forum Qt Programming
    Replies: 1
    Last Post: 18th November 2010, 10:03
  3. QPainterPath and QPolygon
    By Muz in forum Qt Programming
    Replies: 0
    Last Post: 18th September 2009, 07:16
  4. QPainterPath.arcTo
    By grellsworth in forum Qt Programming
    Replies: 1
    Last Post: 18th March 2008, 17:36
  5. QPainterPath outlining
    By viridis in forum Qt Programming
    Replies: 2
    Last Post: 14th March 2008, 19:32

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.