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. Set Background-Image of QMainWindow without affecting the subordinate components as well!
Forum Updated to NodeBB v4.3 + New Features

Set Background-Image of QMainWindow without affecting the subordinate components as well!

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 682 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.
  • A Offline
    A Offline
    AlexKrammer
    wrote on last edited by
    #1

    Hello,
    First I decided to set the background image of every Frame. But i determined that all components inside the frames were affected aswell. So the other way i tried was to set the Background image for the hole QMainWindow but i determined the same problem?

    How could i set the background image without affecting the subordinated components?

    It should look like this,
    73c68147-918e-4252-94ba-4e485892b99b-image.png

    but is looks like that, that everything includes the background double and triple times:

    f71bb023-76a7-49bb-958a-afb9fbd1ee2f-image.png

    Pl45m4P 1 Reply Last reply
    0
    • A AlexKrammer

      Hello,
      First I decided to set the background image of every Frame. But i determined that all components inside the frames were affected aswell. So the other way i tried was to set the Background image for the hole QMainWindow but i determined the same problem?

      How could i set the background image without affecting the subordinated components?

      It should look like this,
      73c68147-918e-4252-94ba-4e485892b99b-image.png

      but is looks like that, that everything includes the background double and triple times:

      f71bb023-76a7-49bb-958a-afb9fbd1ee2f-image.png

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @AlexKrammer

      You used stylesheet?

      You need to specify the objectName of the object that should have your background-image.
      Something like:

      this->setStyleSheet("QMainWindow#objectName { background-image: /path/to/img.png; }");
      

      Otherwise all childs will inherit this background too (if possible).


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      A 1 Reply Last reply
      2
      • Pl45m4P Pl45m4

        @AlexKrammer

        You used stylesheet?

        You need to specify the objectName of the object that should have your background-image.
        Something like:

        this->setStyleSheet("QMainWindow#objectName { background-image: /path/to/img.png; }");
        

        Otherwise all childs will inherit this background too (if possible).

        A Offline
        A Offline
        AlexKrammer
        wrote on last edited by
        #3

        @Pl45m4 Oh great now its working. So if i want to show any stylesheet e.g. only on one frame and not on his childs, i have to use that #Methode?
        Thanks

        Pl45m4P 1 Reply Last reply
        0
        • A AlexKrammer

          @Pl45m4 Oh great now its working. So if i want to show any stylesheet e.g. only on one frame and not on his childs, i have to use that #Methode?
          Thanks

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by
          #4

          @AlexKrammer said in Set Background-Image of QMainWindow without affecting the subordinate components as well!:

          So if i want to show any stylesheet e.g. only on one frame and not on his childs, i have to use that #Methode?

          See here, especially this part.


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          1 Reply Last reply
          3

          • Login

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