Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Diskplaying a background image in main window.
Very new to all this qt and programming but I am starting to learn slowly.
I have an issue setting a .jpg picture as the back ground in the main window on qt creator , here is the code
, ui(new Ui::MainWindow)
I have already used Qpixmap and had the background working however I could not add text or wodgets over the top.
After some more reading I came across the above example but when I run the code no image appears
Can anybody help me out
hi @DanJenk and welcome,
try it with the following
You can using a resource file instead of direct path.
Works much better later on other pc :)
Add the res file
Add the image
Take the path
use res path in stylesheet
@mrjj thankyou very much the image is now showing however its far too big to pick out all the detail how would I resize ity and shrink it down ?
I plan to use the ui on a 10 inch touchscreen 1280x800
I would use an image app and scale it down it to the needed res.
(1280x800) and see how that looks.
@mrjj Thanks again I had resized it in gimp however I forgot to add the new file to resources problemsolved
keep in mind, when you modify your resource files, (e.g adding a new picture or editing an existing one)
make sure to make a clean rebuild of your project, clean -> run qmake -> build, otherwise the changes my not be applied/ files not found