Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Background Image in qss? [SOLVED}
Forum Updated to NodeBB v4.3 + New Features

Background Image in qss? [SOLVED}

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 3.7k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    sos1
    wrote on last edited by
    #1

    How can I set the background image for all of the screens in my application in the qss stylesheet file? Is it possible?

    Regards,
    James

    1 Reply Last reply
    0
    • musimbateM Offline
      musimbateM Offline
      musimbate
      wrote on last edited by
      #2

      Hi just apply the stylesheet to your QApplication instance.This "link.":http://www.qtcentre.org/threads/12454-how-to-apply-stylesheet-defined-in-qss-file-to-qt-application should help

      Why join the navy if you can be a pirate?-Steve Jobs

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sos1
        wrote on last edited by
        #3

        Sorry, I should have been more explicit.

        I have applied my stylesheet in the main.c and that works for buttons & other widgets throughout my application. Now, I wonder can I place code in the stylesheet to load the screen background?

        My question is, how can I do something like this in a stylesheet:-

        @ setStyleSheet("background-image: url(:/logo/MMbgTest4.jpg);");
        @

        1 Reply Last reply
        0
        • musimbateM Offline
          musimbateM Offline
          musimbate
          wrote on last edited by
          #4

          If i understood you correctly, you want to apply a background to your mainwindow .Just apply the style sheet to whatever widget is your mainWindow.This "thread":http://qt-project.org/forums/viewthread/1397 has something similar to what you want.
          Happy coding!

          Why join the navy if you can be a pirate?-Steve Jobs

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sos1
            wrote on last edited by
            #5

            I wanted to be able to set the the background to all screens in my application and the following added to the .qss file works.

            @QWidget {
            background-image: url(:/logo/MMbgTest4.jpg);
            }@

            Thanks for your help.

            Regards,
            James

            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