Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] Multi colored PolyLines?



  • Is there a way to draw PolyLines with a QPainter, so that each element of the polyline may have a different color or do I have to realize this with seperate lines?



  • You can use a QLinearGradient and pass it to QPainter using QBrush and setBrush()!


  • Moderators

    If loladiro's suggestion doesn't do what you need, then you'll need to draw each line segment on your own by iterating over the line segments and adjusting the pen accordingly for each one.



  • [quote author="mlong" date="1311786901"]If loladiro's suggestion doesn't do what you need, then you'll need to draw each line segment on your own by iterating over the line segments and adjusting the pen accordingly for each one.
    [/quote]

    Already did it this way (also for another couple or reasons!)

    Thanks


Log in to reply