Hi,
I'm trying to draw a rectangle into a QImage using QPainter but I don't know what I'm doing wrong. This code is executed out of the paintEvent
qPainter.setBrush(Qt::NoBrush);
qPainter.setPen(Qt::red);
qPainter.drawRect(iX,iY,iWidth,iHeight);
ui.
imageLabel->setPixmap
(QPixmap::fromImage(qImage
));
QPainter qPainter(&qImage);
qPainter.setBrush(Qt::NoBrush);
qPainter.setPen(Qt::red);
qPainter.drawRect(iX,iY,iWidth,iHeight);
ui.imageLabel->setPixmap(QPixmap::fromImage(qImage));
To copy to clipboard, switch view to plain text mode
The image is showed but not the rectangle.
"iX,iY,iWidth,iHeight" have values into the image size.
Thanks,
Bookmarks