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 QStackedWidget Background color?

Set QStackedWidget Background color?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 2.8k 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.
  • T Offline
    T Offline
    Taytoo
    wrote on last edited by
    #1

    I want to set background color of QStackedWidget to white but the stylesheet isn't taking effect. Also tried applying the stylesheet directly to the page, but that didn't work either.

    The only way to get it to work is: QWidget { background-color: white} but that changes background of all controls on the page to white as well.

    KillerSmathK 1 Reply Last reply
    0
    • T Taytoo

      I want to set background color of QStackedWidget to white but the stylesheet isn't taking effect. Also tried applying the stylesheet directly to the page, but that didn't work either.

      The only way to get it to work is: QWidget { background-color: white} but that changes background of all controls on the page to white as well.

      KillerSmathK Offline
      KillerSmathK Offline
      KillerSmath
      wrote on last edited by KillerSmath
      #2

      @Taytoo

      You can use apply the style in QWidgets inside a QStackedWidgets (Child)
      Css Selector [>]

      QStackedWidget > QWidget{
      background: #ff0000;
      }
      

      @Computer Science Student - Brazil
      Web Developer and Researcher
      “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

      T 1 Reply Last reply
      2
      • KillerSmathK KillerSmath

        @Taytoo

        You can use apply the style in QWidgets inside a QStackedWidgets (Child)
        Css Selector [>]

        QStackedWidget > QWidget{
        background: #ff0000;
        }
        
        T Offline
        T Offline
        Taytoo
        wrote on last edited by
        #3

        @KillerSmath said in Set QStackedWidget Background color?:

        @Taytoo

        You can use apply the style in QWidgets inside a QStackedWidgets (Child)
        Css Selector [>]

        QStackedWidget > QWidget{
        background: #ff0000;
        }
        

        That worked. Thanks!

        Does 'background' and 'background-color' have same effect? I've been using background-color all along.

        KillerSmathK 1 Reply Last reply
        0
        • T Offline
          T Offline
          Taytoo
          wrote on last edited by
          #4

          Nevermind.

          In case anyone else is interested: Explanation here

          1 Reply Last reply
          0
          • T Taytoo

            @KillerSmath said in Set QStackedWidget Background color?:

            @Taytoo

            You can use apply the style in QWidgets inside a QStackedWidgets (Child)
            Css Selector [>]

            QStackedWidget > QWidget{
            background: #ff0000;
            }
            

            That worked. Thanks!

            Does 'background' and 'background-color' have same effect? I've been using background-color all along.

            KillerSmathK Offline
            KillerSmathK Offline
            KillerSmath
            wrote on last edited by
            #5

            @Taytoo
            Yes same effect.

            Background is just more generic.
            When you set background-color, you are changing just the color of background. But with background tag, you can set more than one setting on background as image, repeat, position, size, in one line :)

            @Computer Science Student - Brazil
            Web Developer and Researcher
            “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

            1 Reply Last reply
            1

            • Login

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