Hi I am having a problem making my own QwtPlotCurve style. I want to make dotted lines like this post http://www.qtcentre.org/threads/2017...ht=dottedlines but I can't figure out how to call my new curve style.
My question is how do I actually call my style?
right now I put the built in curve styles into a list of styles like this
for( int i = 0; i < 4; i++)
this->Styles[i] = Styles[i];
QwtPlotCurve::CurveStyle Styles[] = { QwtPlotCurve::Lines, QwtPlotCurve::Sticks, QwtPlotCurve::Steps, QwtPlotCurve::Dots};
for( int i = 0; i < 4; i++)
this->Styles[i] = Styles[i];
To copy to clipboard, switch view to plain text mode
am I supposed to add QwtPlotCurve::UserCurve into that list, and if so how do I make sure it calls my reimplemented drawCurve? I think I am missing something basic.
Another idea that I had was to just call my class when I try to set the style
curve->setStyle(dotLines->DottedLines);
curve->setStyle(dotLines->DottedLines);
To copy to clipboard, switch view to plain text mode
but I get the error 'QwtPlotCurve::setStyle' : cannot convert parameter 1 from 'DotLines::curveStyle' to 'QwtPlotCurve::CurveStyle'
which confuses me because my class DotLines inherits from QwtPlotCurve
public:
enum curveStyle
{
};
QwtPlotCurve::drawCurve(painter, style, xMap, yMap, canvasRect, from, to
);
}else{
/// make dotted lines
}
};
class DotLines : public QwtPlotCurve{
public:
enum curveStyle
{
DottedLines = QwtPlotCurve::UserCurve + 1000
};
virtual void drawCurve( QPainter * painter, int style, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const{
if( style < QwtPlotCurve ::UserCurve )
QwtPlotCurve::drawCurve(painter, style, xMap, yMap, canvasRect, from, to );
}else{
/// make dotted lines
}
};
To copy to clipboard, switch view to plain text mode
Any Ideas? Thanks
Bookmarks