Results 1 to 8 of 8

Thread: How to stop child widgets from inheriting parent's StyleSheet and use system default?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2007
    Posts
    56
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to stop child widgets from inheriting parent's StyleSheet and use system defa

    Thanks guys. I ended up using the name of my widget for the stylesheet and that worked OK.

  2. #2
    Join Date
    Dec 2010
    Location
    Ukraine, Kharkiv
    Posts
    17
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question How to stop child widgets inheriting parent's StyleSheet and use system default

    How to do the same in DESIGN MODE?

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to stop child widgets inheriting parent's StyleSheet and use system default

    What do you mean?
    The style sheet is not aware in which "mode" you are.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  4. #4
    Join Date
    Dec 2010
    Location
    Ukraine, Kharkiv
    Posts
    17
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to stop child widgets inheriting parent's StyleSheet and use system default

    I have Frame. I drop Button on it.
    Now I want Frame to have border-style: solid und border-width: 5px. I click on Frame->Change styleSheet... and write it there. I have what I want. Frame have solid border with 5px width. BUT, button have the same.
    Ok.
    Now I want button to have it's DEFAULT values for border-style and border-width. I want for this button to switch off StyleSheet inheritance.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to stop child widgets inheriting parent's StyleSheet and use system default

    No, you don't. You want the stylesheet to apply to one particular widget. Use a selector that will apply to this widget and not to the button, for example:
    css Code:
    1. .QFrame { border-style: solid; border-width: 5px; }
    To copy to clipboard, switch view to plain text mode 
    ... or ...
    css Code:
    1. #myFrameName { border-style: solid; border-width: 5px; }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    Chiz (13th January 2011)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.