SOLVED: How can i input a jpeg background Image on a QT Form?
-
Hi, Is it possible to change the background of a form to an image? If so, how? I have tried going onto Design Mode and Edit Style Sheet but i only end up with a select resource pop up bar with nothing in it. I cannot filter through anything.
-
Did you create resources file with appropriate image files in side ? Then you will be able to see the images inside the resource file. Hope this is what you are asking for.
-
I've right-clicked my QTProject folder under the 'Projects' panel and clicked on 'Add New...'. From the pop up, i selected 'Qt', 'Qt Resource File' and then 'Choose...'. I have named the file 'Step1' and located it in my public pictures folder, then clicked 'Next' and 'Finish'. After that a window appeared and i added a new prefix, named it 'step2' and added a file (image) to it and named it 'step3.png' (i also addded another file and named it 'step4.jpg'). Now when i try to add a stylesheet to the ui, i still have no resource root :/
-
IMHO the easiest way to deal with the path to a resource in a qrc file is to give it an alias.
So give step3.png the alias "step3.png" and step4.jpg the alias "step4.jpg" (without the quotes).
Then access it using :/step3.png and :/step4.jpg wherever needed. -
I hope "this":http://developer.nokia.com/community/wiki/How_to_use_Resource_Editor_with_Qt_Creator link will get you through. It's an old link. But still the steps are same apart from some minor fancy changes.
-
Yes i think i got it!! It just needed to refresh itself :) Thank you!!