PDA

View Full Version : QPen has no effect



timmu
3rd January 2013, 09:43
I'm drawing an image (see below) and it works in principle. However, for some reason two of the commands don't make any difference as if they weren't seen by the compiler. Does anyone have any ideas why?



QPixmap map(100,100);

map.fill(Qt::white);
QPainter p(&map);
QPen pen;
pen.setStyle(Qt::DashDotLine);//doesn't make a difference
pen.setWidth(3); //doesn't make a difference
p.setPen(QColor(0,0,0));

p.drawLine(50,50,100,100);

map.save("file.jpg", 0, 90);

Santosh Reddy
3rd January 2013, 12:39
QPixmap map(100,100);

map.fill(Qt::white);
QPainter p(&map);
QPen pen;
pen = p.pen();
pen.setStyle(Qt::DashDotLine);
pen.setWidth(3);
pen.setColor(QColor(0,0,0));
p.setPen(pen);
p.drawLine(50,50,100,100);

map.save("file.jpg", 0, 90);