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. Applying a certain stylesheet at the mainwindow, will also be applied to any QWidget in that window
Forum Updated to NodeBB v4.3 + New Features

Applying a certain stylesheet at the mainwindow, will also be applied to any QWidget in that window

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.5k 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.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    So i had set the mainwindows stylesheet as:
    @border-image: url(:/icons/Pictures/Background.png) 4 4 4 4 stretch stretch;@

    !http://i.imgur.com/9zoCxwE.png(1)!

    In the above screenshot u can see
    2 spacers
    a Qwidget
    inside of the Qwidget a label

    The qwidget has stylesheet
    @QWidget {\nbackground-color: black;\n}@

    but u can see that the background is not black... why is that?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      Hi,

      style sheets are always also valid for derived classes.
      But you have moire options for the selector, so if your main windows class has a special name (or a special class) use that as selector and it does what you want. Have a look at the style sheet documentation.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        Not only for derived classes, but especially for child objects. That's why they are called cascading: any style you set on a parent object, will propagate down towards child widgets too. There is no way to stop that from happening, other than to use a more specific selector for the parent style so that it does not apply to the child widgets you don't want it to apply for.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          [quote author="Andre" date="1359996737"]Not only for derived classes, but especially for child objects. [/quote]

          Ups, thats what I wanted to say... :-)

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          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