Hi!
I am trying to get the path top a QImage for my application.
I did as followd:
My problem is that I can not load any image.
What could be the problem? I will appreciate any help.
Many thanks in advance.
Hi!
I am trying to get the path top a QImage for my application.
I did as followd:
My problem is that I can not load any image.
What could be the problem? I will appreciate any help.
Many thanks in advance.
Where is the image name ? "myImage.png" , myImage.jpg ?? which one ?
Also what is the output of QCoreApplication::applicationDirPath() ?
Many thanks aamer4yu for your reply.
The image name should be myImage.png.
Have a look please. When I proceed as followed, I do not need to add ".png", and I can have the image loaded. But I do not want to go this way.
Qt Code:
image.load("C:/Users/Desktop/myImage");To copy to clipboard, switch view to plain text mode
Even by writing myImage.png, there is no change.
I have created a label on which th image should appear as followed:
Qt Code:
m_image->setPixmap(myImage);To copy to clipboard, switch view to plain text mode
Last edited by Stanfillirenfro; 15th January 2014 at 10:43.
Are you sure you know what QCoreApplication::applicationDirPath() returns ?
Thanks Lesiok!
Yes, QCoreApplication::applicationDirPath() returns the directory that contains the application executable.
Please put a qDebug() for QCoreApplication::applicationDirPath() value...
Bookmarks