Results 1 to 5 of 5

Thread: multiple color in QPainterPath

  1. #1
    Join Date
    Jul 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default multiple color in QPainterPath

    Folks,

    I am trying to draw a multi segment line with different color of each part, is there any ways to do this with QPainterPath ?

    Coz there will be hundreds of segments, so that would be great if not using hundreds of path.

    -Ed

  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: multiple color in QPainterPath

    QPainterPath only stores shapes, not their properties such as colours.
    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. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: multiple color in QPainterPath

    QGradientand its subclasses might be of interest to you

  4. #4
    Join Date
    Jul 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: multiple color in QPainterPath

    thanks, i know QPainterPath doesnt maintain any information regarding color.
    however, I want drawing a multi-color line into QGraphicsScene for better rotate/zoom in-out handling.

    is there any similar approaches ?

  5. #5
    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: multiple color in QPainterPath

    QPainterPath itself has nothing to do with "drawing". If you want to draw something, take a look at QPainter class. There is a QPainter::drawLine() method that is meant to draw lines. You can loop over your set of lines, change pen colours and draw lines.
    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.


Similar Threads

  1. QPainterPath and QPolygon
    By Muz in forum Qt Programming
    Replies: 0
    Last Post: 18th September 2009, 07:16
  2. Reusing a QPainterPath
    By Micawber in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2009, 19:49
  3. QPainterPath::arcTo accuracy
    By robertson1 in forum Qt Programming
    Replies: 0
    Last Post: 18th July 2008, 12:13
  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

Tags for this Thread

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.