PDA

View Full Version : set a line with and a color?



kja
2nd December 2010, 18:32
Hi,

I'm having a simple problem but I can't seem to find the answer.
I want to set my plot's width and color. I can set one or the other using QPen but I can't figure out how to set them both! If I try to set them both separately the first one is overwritten by the second. What am I missing?



QwtPlotCurve * curve;

curve->setPen(QPen(Qt::red));

QPen pen;
pen.setWidth(3);

curve->setPen(pen);


thanks

Oh Wow, nevermind, I'm stupid :)


QPen pen;
pen.setWidth(lineWidth);
pen.setColor(Qt::blue);
curve->setPen(pen);

FelixB
3rd December 2010, 07:53
a littel bit shorter:

curve->SetPen(QPen(Color(Qt::red),lineWidth)))