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?
Forum Updated to NodeBB v4.3 + New Features

Set QStackedWidget Background color?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 2.8k 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.
  • T Offline
    T Offline
    Taytoo
    wrote on 19 Apr 2019, 05:44 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.

    K 1 Reply Last reply 19 Apr 2019, 05:56
    0
    • T Taytoo
      19 Apr 2019, 05:44

      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.

      K Offline
      K Offline
      KillerSmath
      wrote on 19 Apr 2019, 05:56 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 19 Apr 2019, 06:02
      2
      • K KillerSmath
        19 Apr 2019, 05:56

        @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 19 Apr 2019, 06:02 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.

        K 1 Reply Last reply 19 Apr 2019, 06:09
        0
        • T Offline
          T Offline
          Taytoo
          wrote on 19 Apr 2019, 06:05 last edited by
          #4

          Nevermind.

          In case anyone else is interested: Explanation here

          1 Reply Last reply
          0
          • T Taytoo
            19 Apr 2019, 06:02

            @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.

            K Offline
            K Offline
            KillerSmath
            wrote on 19 Apr 2019, 06:09 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

            4/5

            19 Apr 2019, 06:05

            • Login

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