xqrp
18th January 2012, 14:44
I'm trying to draw two single pixel lines onto a QImage with the following code:
QPainter linePainter(currentImage);
linePainter.setRenderHint(QPainter::Antialiasing, false);
linePainter.setPen(QPen(Qt::red,1));
linePainter.drawLine(xSize/2, 0, xSize/2, ySize);
linePainter.drawLine(0, ySize/2, xSize, ySize/2);
The image is displayed on a QLabel like this:
ccdDisplayLabel->setPixmap(QPixmap::fromImage(*currentImage));
However, as you can see from the attached image, somewhere along the line something bad happens. The lines should be one pixel wide and bright red, however, the vertical line looks weird. How can I fix this?
7286
QPainter linePainter(currentImage);
linePainter.setRenderHint(QPainter::Antialiasing, false);
linePainter.setPen(QPen(Qt::red,1));
linePainter.drawLine(xSize/2, 0, xSize/2, ySize);
linePainter.drawLine(0, ySize/2, xSize, ySize/2);
The image is displayed on a QLabel like this:
ccdDisplayLabel->setPixmap(QPixmap::fromImage(*currentImage));
However, as you can see from the attached image, somewhere along the line something bad happens. The lines should be one pixel wide and bright red, however, the vertical line looks weird. How can I fix this?
7286