Hi,
The image is readed before painting the rectangle
Hi,
The image is readed before painting the rectangle
Òscar Llarch i Galán
Hi,
Same result. I've also tryied to save the image on disk after calling "qPainter.end()" but the image is the same as the input image.Try calling qPainter.end() before converting the image to a pixmap.
Maybe there is a better way to do what I want:
I have an image loaded from a Database(the image is loaded correctly). The Database also returns me a position and dimension of a rectangle that I want to show over the image. The image is painted on a QLabel scaling it to fill the QLabel dimension(mantaining the aspect ratio of the image), so the position to paint the rectangle are different. This is why I want to paint the rectangle directly into the image before scaling the image.
Thanks,
Last edited by ^NyAw^; 25th January 2013 at 09:12.
Òscar Llarch i Galán
Hi,
I've tried this code in the constructor of a simple program.
Qt Code:
qPainter.setBrush(Qt::NoBrush); qPainter.setPen(Qt::red); qPainter.drawRect(150,150,50,50); bool bEnd = qPainter.end(); qImage.save("b.bmp");To copy to clipboard, switch view to plain text mode
With this I'll get the image "b.bmp" that is the same as "a.bmp" but with a red rectangle painted on position (150px,150px) with a widht and height of 50px.
This don't work as "b.bmp" is identical as "a.bmp"
Thanks,
Òscar Llarch i Galán
What is the format of the BMP image? Is it 8b (indexed) or 24b (true color)?
Bookmarks