Hi,
i subclassed QwtPlotCurve to add new functions that we need.
One point is adding QwtPlotMarker into plot that belong to the curve and
will be attached, detached, setVisible together with the curve. Is all working.
But if some one change the color of the curve, all QwtPlotMarker should change
the color also. The marker has a custom symbol and if i try to set the brush color
o got this error:
passing 'const QwtSymbol' as 'this' argument of void::QwtSymbol::setBrush(const QBrush&) discards qualifiers
What i'm doing wrong?
curve->setPen(color,2.0); // change curve color
curve->setMarkerColor( color ) // change marker color
curve->setPen(color,2.0); // change curve color
curve->setMarkerColor( color ) // change marker color
To copy to clipboard, switch view to plain text mode
// in class PlotCurve::PrivateData
QList<QwtPlotMarker *> qlMarkerError1;
void PlotCurve
::setMarkerColor( QColor color
) const {
{
QBrush brush
= marker
->symbol
()->brush
();
brush.setColor( color );
marker->symbol()->setBrush( brush ); // ERROR LINE
}
}
// in class PlotCurve::PrivateData
QList<QwtPlotMarker *> qlMarkerError1;
void PlotCurve::setMarkerColor( QColor color ) const
{
foreach (QwtPlotMarker *marker, d_data->qlMarkerError1)
{
QBrush brush = marker->symbol()->brush();
brush.setColor( color );
marker->symbol()->setBrush( brush ); // ERROR LINE
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks