PDA

View Full Version : Draw a line



Daan
27th August 2009, 18:16
I try to draw a line using the following code:

bool ok;
QPainter p;
ok=p.begin(this);
QColor qcred(Qt::red);
p.setPen(qcred);
p.drawLine(10, 80, 90, 20);
p.end();

ok has the value true.

However, I don't see a line drawn. How do I solve this?

Daan

Lykurg
27th August 2009, 18:29
what is "this"? can you show us some little more code? And eventually the coordinates of your line are outside the visible area of your widget(or whatever you use.)