Pixel accurate painting on Widget
Unsolved
General and Desktop
-
Hi,
I need to draw lines that are pixel accurate.
So when executing this code:QPainter painter(this);
painter.setPen(QPen(QColor(20,20,20), 1));
painter.drawLine(10,10,10,100);
painter.drawLine(15,10,15,100);
painter.drawLine(20,10,20,100);
painter.drawLine(25,10,25,100);I expect 4 vertical lines of one bit wide.
But what I get is this:Lines of one pixel and lines of 2 pixels wide. How is that possible?
How can I draw lines that are always 1 pixel width?
Is there some other way to draw at pixel accuracy? Can I set individal pixels in an efficient way?