@mrjj thank you for answer
I'm sorry, I forgot to add lines where I apply QLinearGradient to the curve that was generated with QwtPlotCurve:
QwtPlotCurve *curve = new QwtPlotCurve();
QLinearGradient linearGrad(QPointF(0, 0), QPointF(1, 0));
linearGrad.setCoordinateMode(QGradient::ObjectMode);
linearGrad.setColorAt(0, Qt::yellow);
linearGrad.setColorAt(0.5, Qt::red);
linearGrad.setColorAt(1, Qt::cyan);
QGraphicsOpacityEffect* opacity = new QGraphicsOpacityEffect;
opacity->setOpacity(0);
opacity->setOpacityMask(linearGrad);
curve->setBrush(linearGrad);
So the filled area is the area between the curve and some baseline located at y=10000
I found a way to set opacity of each color like:
QColor green70 = Qt::green;
green70.setAlphaF(0.7); // here we set the opacity (or more likely transparency)
linearGrad.setColorAt(1, green70);
That works but if I want to change the opacity I would need to change alpha of every color in loop. Actually that is not so bad but I'm trying to implement linear colorbar where colors are linearly changeable and they are set by some value (not by a name like red or green).