Reputation: 4733
Original design :
Setting in property :
When the program is running :
All the image inside the project folder "QuickRecorder/Images/MainWindow". How to solve this problem?
Thank you for your help.
Upvotes: 1
Views: 334
Reputation: 62797
In cases like this the reason almost always is: You use relative path to the image, and the working directory is different when you run the application, and image is not found by the relative path.
To debug, add this to your main
to print current working directory:
qDebug() << QDir::currentPath();
A few solutions:
QCoreApplication::applicationDirPath()
, instead of hard-coding).Untested, moved from comment to answer: To automatically copy files from the source dir to the build dir, you could add a build step "Custom Process Step" in the Qt Creator project settings. The command you might want to use for the case of this question might be (again, untested):
cp -rv %{sourceDir}/QuickRecorder %{buildDir}
Upvotes: 1