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

Qt Code:
  1. QPainter qPainter(&qImage);
  2. qPainter.setBrush(Qt::NoBrush);
  3. qPainter.setPen(Qt::red);
  4. qPainter.drawRect(iX,iY,iWidth,iHeight);
  5. 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,