PDA

View Full Version : style sheets select all except something



codeslicer
5th March 2008, 00:19
Alright, I have an application in which I use style sheets. Now I have a problem. In my application, I use this:



* {
background-color: black;
}


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:



QMenu {
background-color: somedifferentcolor;
}


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:



*:not(QMenu) {
background-color: black;
}


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!

codeslicer
5th March 2008, 11:30
Bump...

Anyone?

wysota
5th March 2008, 11:59
I don't know if it works but you may try:
* { background-color: black; }
QMenu { background-color: inherit; }

codeslicer
6th March 2008, 00:04
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...

wysota
6th March 2008, 00:21
Yes, we're aware of the bug. But it's either answering questions or fixing bugs, so... bugs are waiting for better days :)