PDA

View Full Version : QwtPlotCurve color for connecting lines



orignihn
27th April 2011, 22:01
I'm trying to draw various styles for a QwtPlotCurve, and the only color I get is black. I can make the symbols whatever color I choose, but the symbol color isn't changing the connecting lines.



... // m_graphics is a QwtPlotCurve*

int curve_style = get_curve_style();
int symbol_style = get_symbol_style();
int pen_style = get_pen_style();
QColor c = get_color();

m_graphics->setStyle(static_cast<QwtPlotCurve::CurveStyle>(curve_style));
m_graphics->setPaintAttribute(QwtPlotCurve::PaintFiltered);

QwtSymbol symbol;
QPen p;
QBrush b;
b.setStyle(Qt::SolidPattern);
b.setColor(c);

p.setStyle(static_cast<Qt::PenStyle>(pen_style));
p.setColor(c);

symbol.setBrush(b);
symbol.setPen(p);
symbol.setSize(QSize(5,5));
symbol.setStyle(static_cast<QwtSymbol::Style>(symbol_style));

m_graphics->setSymbol(symbol);


m_graphics is later used by calling setRawData() and then draw(int, int). I'm using Qwt 5.2.1.

Why doesn't the color "c" get used for the lines connecting the symbols?

Thanks,
Tom

Uwe
28th April 2011, 07:08
Use QwtPlotCurve::setPen(), see: http://qwt.sourceforge.net/class_qwt_plot_curve.html#a08328abaf2c3b67e479d1e4 85d2d0c4d

Uwe