Your screenshots are too small to read. Please post the ACTUAL CODE, not screenshots so we can read what you are doing. Put your code inside CODE tags (see my signature below).
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
Qt Code:
ui->label_Pic->setPixmap(pix)To copy to clipboard, switch view to plain text mode
and then i get this error: no member named 'label_Pic' in 'Ui::MainWindow'
Qt Code:
<widget class="QLabel" name="label_Pic"> <property name="geometry"> <rect> <x>20</x> <y>20</y> <width>151</width> <height>221</height> </rect> </property> <property name="text"> <string/> </property>To copy to clipboard, switch view to plain text mode
This is from my mainwindow.ui
Manually run qmake (rightclick on project -> run qmake) and re-compile the project a few times. Sometimes there are hickups.
Yes, I agree. I don't see anything wrong with the code or ui file, and support for "png" format is built-in and does not require a separate driver. So probably your ui file did not get compiled after you added or changed the name of the QLabel item.Manually run qmake
Also, make sure when you use a backslash ("") in string that you "escape" it: "C:\\folder\\filename.png" If you don't it will treat a "\f" as a special character and the actual filename string that gets passed to setPixmap() will be incorrect.
Last edited by d_stranz; 5th March 2019 at 18:30.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
Bookmarks