Details
-
Suggestion
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.5.0
-
None
Description
I added some color stops by using the QGradient::setStops() function like this
QGradientStops stops;
stops.append( QGradientStop(0.0, QColor(Qt::red)));
stops.append( QGradientStop(0.5, QColor(Qt::green)));
stops.append( QGradientStop(0.5, QColor(Qt::black)));
stops.append( QGradientStop(1.0, QColor(Qt::blue)));
QLinearGradient g;
g.setStops( stops );
I expected to get a gradient with four color stops.
Instead I got a gradient with three color stops, where the third color stop just replaced the second one.
I think a gradient with the color stops like shown above is perfectly valid as it allows some quick color changes within a gradient on a single position (from one color to another). As the setStops function apparently uses the setColorAt function, only unique color stop positions are possible. That is rather bad if you develop a way to let the user move the color stops with the mouse. Once the user crosses one color stop with another, one of them is deleted when adding them to a QGradient.