How to display a picture
-
Yes i tried too before post but i had one error too, so i post the first error.
The second is :
No matching function for call to 'Qlabel::setPixmap(QPixmap*)"Lifetime Qt Championwrote on 6 Oct 2016, 20:59 last edited by mrjj 10 Jun 2016, 21:02@Payx
Sorry not enough coffee :)QPixmap pix(fileName );
setPixmap(pix); -
wrote on 7 Oct 2016, 08:37 last edited by Pradeep Kumar 10 Jul 2016, 08:38
If u are using QImage
m_imageLabel = new QLabel; QImage imagePixmap; imagePixmap.load(":/new/prefix1/Images/imageName.extension"); m_imageLabel->setPixmap(QPixmap::fromImage(imagePixmap));
Or
Only QPixmap
m_imageLabel = new QLabel; QPixmap imagePixmap; imagePixmap.load(":/new/prefix1/Images/imageName.extension"); m_imageLabel->setPixmap(imagePixmap);
imageName.extension can be image.png, image.jpeg.
-
If u are using QImage
m_imageLabel = new QLabel; QImage imagePixmap; imagePixmap.load(":/new/prefix1/Images/imageName.extension"); m_imageLabel->setPixmap(QPixmap::fromImage(imagePixmap));
Or
Only QPixmap
m_imageLabel = new QLabel; QPixmap imagePixmap; imagePixmap.load(":/new/prefix1/Images/imageName.extension"); m_imageLabel->setPixmap(imagePixmap);
imageName.extension can be image.png, image.jpeg.
wrote on 7 Oct 2016, 08:55 last edited by@Pradeep-Kumar said in How to display a picture:
If u are using QImage
m_imageLabel = new QLabel; QImage imagePixmap; imagePixmap.load(":/new/prefix1/Images/imageName.extension"); m_imageLabel->setPixmap(QPixmap::fromImage(imagePixmap));
Or
Only QPixmap
m_imageLabel = new QLabel; QPixmap imagePixmap; imagePixmap.load(":/new/prefix1/Images/imageName.extension"); m_imageLabel->setPixmap(imagePixmap);
imageName.extension can be image.png, image.jpeg.
U didnt read the thread i think :-).
But thx@mrjj Lol no problem :-)
Thanks it works i will create an other thread for an other question after -
wrote on 7 Oct 2016, 09:01 last edited by
Thread says how to display a picture
@Payx
Is this the thing?.
correct me if i was wrong. -
Thread says how to display a picture
@Payx
Is this the thing?.
correct me if i was wrong.wrote on 7 Oct 2016, 09:08 last edited by@Pradeep-Kumar said in How to display a picture:
Thread says how to display a picture
@Payx
Is this the thing?.
correct me if i was wrong.wow u just answer the question after 5 guys answer me.
-
wrote on 7 Oct 2016, 09:48 last edited by
Hmmmmmmmmmm was toooooooooooo late.:)))
-
@Pradeep-Kumar said in How to display a picture:
If u are using QImage
m_imageLabel = new QLabel; QImage imagePixmap; imagePixmap.load(":/new/prefix1/Images/imageName.extension"); m_imageLabel->setPixmap(QPixmap::fromImage(imagePixmap));
Or
Only QPixmap
m_imageLabel = new QLabel; QPixmap imagePixmap; imagePixmap.load(":/new/prefix1/Images/imageName.extension"); m_imageLabel->setPixmap(imagePixmap);
imageName.extension can be image.png, image.jpeg.
U didnt read the thread i think :-).
But thx@mrjj Lol no problem :-)
Thanks it works i will create an other thread for an other question afterwrote on 7 Oct 2016, 10:19 last edited byThanks it works i will create an other thread for an other question after
If it is working can u mark thread has solved, so it will be useful in future.
Cheers.:)))))))Thanks,
-
wrote on 7 Oct 2016, 11:45 last edited by
How can i do that ?
-
wrote on 7 Oct 2016, 11:46 last edited by Pradeep Kumar 10 Jul 2016, 11:46
u have already marked as solved for this thread.
-
wrote on 7 Oct 2016, 11:49 last edited by
Anyways in the right bottom of the topic u will see topic button and u see mark as solved under the topic button, click on it.
:)
Thanks.
-
wrote on 28 Sept 2020, 10:30 last edited by
The link address has expired
Please pay attention to select the example corresponding to your current qt version in the upper right corner
https://code.qt.io/cgit/qt/qtbase.git/tree/examples/widgets/widgets/imageviewer?h=5.15 -
This post is deleted!
-
M Maybecute referenced this topic 19 days ago