Hi to all,
I have to draw some lines in the paint event of an widget.
I set a pen with width = 1 but the real width of the pen is visibility bigger than 1 pixel and the width method
return 1 as value...odd

Here some code:

Qt Code:
  1. QPixmap temp = QPixmap( w, h ); // I draw on a pixel to cache
  2.  
  3. QPainter p( &temp );
  4. p.setRenderHint( QPainter::Antialiasing, true );
  5. p.fillRect( temp.rect(), Qt::lightGray );
  6.  
  7. // temporal line
  8. QPen pen(Qt::black, 1); //<---- 1 pixel wide
  9. pen.setStyle(Qt::SolidLine);
  10. p.setPen(pen);
  11. p.drawLine(0, 20, w, 20); //width of the line bigger than 1 pixel
  12. qDebug() << "Pen width: " << pen.width(); // returns 1
To copy to clipboard, switch view to plain text mode 

Any idea?

Best