Hi
How do I set an QImage on a QLabel?
I'm really stuck!
Cheers
Printable View
Hi
How do I set an QImage on a QLabel?
I'm really stuck!
Cheers
Try this:
Code:
int main(int argc, char** argv) { imageLabel.setPixmap(image); label.show(); return app.exec(); }
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()?