ARTICLE AD BOX
I am trying to just setup a background image for a widget, and my app seems to not be able to parse the images from resources when ran.
startScreen::startScreen(QWidget *parent) : QDialog(parent) , ui(new Ui::startScreen) { ui->setupUi(this); QPixmap* pic{}; pic = new QPixmap(":/pics/images/startscreen_dark.png"); if(pic->isNull()){ qDebug()<<"Red Texture could not be loaded!"; } QWidget::setStyleSheet("background-image: :/pics/images/startscreen_dark.png;"); }When I hover over the path on pic, Qt Creator does preview it for me. When I use the QT designer, I can also set the stylesheet for the widget and see it in the designer but not when I run the app.
The output is
startscreen_dark could not be loaded! Could not create pixmap from :/pics/images/startscreen_dark.png Could not create pixmap from :/pics/images/startscreen_dark.png Could not create pixmap from :/pics/images/startscreen_dark.png Could not create pixmap from :/pics/images/startscreen_dark.pngThe path is correct (since also QtCreator does preview the image for me in the IDE), and I am really not sure what could be causing this.
Explore related questions
See similar questions with these tags.
