Problem with ressource file
-
Hi and welcome to devnet,
Can you share the content of the file ?
And an example of line you use to load an image in a QLabel ?
-
Hi and welcome to devnet,
Can you share the content of the file ?
And an example of line you use to load an image in a QLabel ?
@SGaist
File untitled3.pro:#-------------------------------------------------
Project created by QtCreator 2016-07-25T14:54:55
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = untitled3
TEMPLATE = appSOURCES += main.cpp
mainwindow.cppHEADERS += mainwindow.h
FORMS += mainwindow.ui
RESOURCES +=
ress.qrc
Here I load the pic in the QLabel. It's also highlighted in the image in the first post:
ui->pic->setPixmap(pic.scaled(ui->pic->width(),ui->pic->height(),Qt::KeepAspectRatio));
ui->pic is the QLabel
pic is the QPixmal created above. -
The code in the screeshot looks fine.
Did you specify an alias in the qrc-file?
Can you paste the plaintext content of the qrc-file? -
Is rcc run on the resource file at all?
qmake is terrible at detecting changes in the .pro file, try clearing everything and then rebuild
-
Also, the .pro file that you posted should not work correctly. Newlines in pro files are the same as
;in C++RESOURCES += ress.qrcshould become
RESOURCES += ress.qrcsame as
SOURCES += main.cpp mainwindow.cppshould become
SOURCES += main.cpp \ mainwindow.cpp -
Also, the .pro file that you posted should not work correctly. Newlines in pro files are the same as
;in C++RESOURCES += ress.qrcshould become
RESOURCES += ress.qrcsame as
SOURCES += main.cpp mainwindow.cppshould become
SOURCES += main.cpp \ mainwindow.cpp -
@VRonin I've rebuild the project, still can't see the image. I'll try on a fresh project right now.
-
Also, the .pro file that you posted should not work correctly. Newlines in pro files are the same as
;in C++RESOURCES += ress.qrcshould become
RESOURCES += ress.qrcsame as
SOURCES += main.cpp mainwindow.cppshould become
SOURCES += main.cpp \ mainwindow.cpp