Hey guys,
I try to dynamically change colors of curves in my Qwt plot depending on user interaction, but I can't figure out how I can force QwtPlot to repaint all curves with new colors. This is the code I use for giving my curves their initial color:
brush.setColor(color);
brush.setStyle(Qt::SolidPattern);
QPen pen
(brush,
2,Qt
::SolidLine);
this->setPen(pen);
bgColor.setAlphaF(0.3f);
brush.setColor(bgColor);
this->setBrush(brush);
}
Curve::Curve(QColor color) {
QBrush brush;
brush.setColor(color);
brush.setStyle(Qt::SolidPattern);
QPen pen(brush,2,Qt::SolidLine);
this->setPen(pen);
QColor bgColor = color;
bgColor.setAlphaF(0.3f);
brush.setColor(bgColor);
this->setBrush(brush);
this->setRenderHint(QwtPlotItem::RenderAntialiased);
}
To copy to clipboard, switch view to plain text mode
where Curve publicly derives from QwtPlotIntervalCurve.
I similar Curve::setColor(QColor color) function does not have any impact if I call it after I attach the curve to the plot. Detaching and re-attaching of the curve does not have any impact either. Any ideas how I can dynamically change the color of existing curves?
Thank you in advance!
Bookmarks