I may be misunderstanding how to do this, hopefully somebody can clarify.
I have placed a QLabel
on my main window from inside Qt Designer. Currently, it just displays the letters " TextLabel
" when I run the program.
I have a line edit where I type in the path to an image, which then loads the image as a QImage
into memory (I have this working).
Finally, I want to display this QImage
. I was told this can be done by QLabels
. I have done the following, but nothing is happening:
ui.input_label->setPixmap(QPixmap::fromImage(my_qimage));
Why is nothing happening? How can I display this image?
If you are sure the image file is ok but then the problem is probably with loading the file into the QImage
. If you are calling QImage::load()
, you are probably getting a return value of false
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.