Results 1 to 5 of 5

Thread: style sheets select all except something

  1. #1
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question style sheets select all except something

    Alright, I have an application in which I use style sheets. Now I have a problem. In my application, I use this:

    Qt Code:
    1. * {
    2. background-color: black;
    3. }
    To copy to clipboard, switch view to plain text mode 

    which sets the background color of all widgets black. Unfortunately though, the menu that appears by right-clicking on an object such as QLineEdit is also black. I do not want this behavior. I know that I can use:

    Qt Code:
    1. background-color: somedifferentcolor;
    2. }
    To copy to clipboard, switch view to plain text mode 

    but that wouldn't be really platform/theme independent, as I want the default style for the menu to remain intact. In CCS3, there is the not() selector, which should be used like this:

    Qt Code:
    1. *:not(QMenu) {
    2. background-color: black;
    3. }
    To copy to clipboard, switch view to plain text mode 

    but Qt doesn't support this. Is there any way in which I can restore the QMenu's default colors or just omit it in the unary selector using Qt Style Sheets?

    Thanks!

  2. #2
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Wink Re: style sheets select all except something

    Bump...

    Anyone?

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

    Default Re: style sheets select all except something

    I don't know if it works but you may try:
    css Code:
    1. * { background-color: black; }
    2. QMenu { background-color: inherit; }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: style sheets select all except something

    It didn't work, thanks for helping though

    I don't have that many widgets that I require using a unary selector (*), so I'll just implicately select which ones I want.

    Also, there is a bug in the forum software. This is how to reproduce it:

    1.) Make sure you aren't logged in.
    2.) Go to a thread and click reply.
    3.) Login.
    4.) You are redirected to a bad url, ie qtcentre.org/forum//forum//forum/newreply.php, which can't be found.

    Not sure where to leave these bugs, but here it is...

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

    Default Re: style sheets select all except something

    Yes, we're aware of the bug. But it's either answering questions or fixing bugs, so... bugs are waiting for better days

Similar Threads

  1. QColor with style sheets
    By tommy in forum Qt Programming
    Replies: 4
    Last Post: 27th December 2007, 05:37
  2. BIG Problem with Background-image using Style Sheets
    By PiXeL16 in forum Qt Programming
    Replies: 1
    Last Post: 28th November 2007, 22:10
  3. ListWidget select style
    By CopyrightPhilly in forum Qt Programming
    Replies: 1
    Last Post: 9th November 2007, 08:45
  4. BG image on QPushButton using style sheets??
    By JimDaniel in forum Newbie
    Replies: 2
    Last Post: 13th September 2007, 03:31
  5. Qt style sheets
    By locus in forum Qt Programming
    Replies: 5
    Last Post: 5th April 2007, 17:03

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.