Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. SOLVED: How can i input a jpeg background Image on a QT Form?
QtWS25 Last Chance

SOLVED: How can i input a jpeg background Image on a QT Form?

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 4 Posters 2.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    crystal_ice
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      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.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • C Offline
        C Offline
        crystal_ice
        wrote on last edited by
        #3

        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 :/

        1 Reply Last reply
        0
        • K Offline
          K Offline
          Kalileo
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • p3c0P Offline
            p3c0P Offline
            p3c0
            Moderators
            wrote on last edited by
            #5

            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.

            157

            1 Reply Last reply
            0
            • C Offline
              C Offline
              crystal_ice
              wrote on last edited by
              #6

              Yes i think i got it!! It just needed to refresh itself :) Thank you!!

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved