Hi
How do I set an QImage on a QLabel?
I'm really stuck!
Cheers
Hi
How do I set an QImage on a QLabel?
I'm really stuck!
Cheers
Try this:
Qt Code:
int main(int argc, char** argv) { imageLabel.setPixmap(image); label.show(); return app.exec(); }To copy to clipboard, switch view to plain text mode
QImage is designed and optimized for I/O, and for direct pixel access and manipulation, while QPixmap is designed and optimized for showing images on screen
I'm trying to use QImage instead of QPixmap, because it is optimized for pixel manipulation.
I tried to create a QImage:
QImage image;
image = QImage(100, 100, QImage::Format_ARGB32);
image.fill(qRgb(0, 100, 100));
and then created a QLabel to set the image:
QLabel *labelImagem=new QLabel;
labelImagem->setPicture(image);
but it won't compile. Any suggestions what is going wrong?
Cheers
What is the error message and what do you make of it? What are the argument types for setPicture()?
Last edited by ChrisW67; 3rd August 2010 at 03:49.
Surprise, surprise. QImage != QPicture! use:
Maluko_Da_Tola (4th August 2010)
Bookmarks