PDA

View Full Version : QSS, trying to make the text on the combo box WHITE not black.



technoViking
21st June 2010, 22:47
hi guys, I've spent HOURS trying ot figure this out and no luck.

Basically I want the combo boxe's font color to be white.
Currently when the user clicks the combo box all the drop down items font color will be WHITE which is correct.
But once they select the item they want, the drop down will dissapear and the item will be in the combobox but it will be black.

So drop down works, but when its not in drop down mode the font color is black which I'm trying to make white.

Here is the QSS I'm using:



myWidget QComboBox
{


selection-color: rgb(255, 255, 255);

color: rgb(255, 255, 255);
background-color: rgb(0, 28, 53);


font: 18pt "Arial";
border: 1px black;
border-image: url(:/Resources/down.png) 10 10 10 10;

}

myWidget QComboBox:on
{ /*shift the text when the popup opens */
selection-background-color: rgb(108, 149, 59);
color: rgb(255, 255, 255);
}

myWidget QComboBox:!on
{ /* shift the text when the popup opens */
selection-background-color: rgb(108, 149, 59);
color: rgb(255, 255, 255);
}

QComboBox QListView
{
background-color: rgb(0, 28, 53);
}






I also had a image I wnated to use instead of using the standard icon for the down arrow on the combo box but for some reason that isn't showing up either.
Any help would be great.

wladek
21st June 2010, 23:32
Hi technoViking,

Instead of the "myWidget QComboBox" syntax try using "QComboBox#myWidget".
I have just created a test widget an i believe the result is the one you are expecting.

Please see the attached screenshot.

Regards,
Wladek.


Here is the complete QSS code:

QComboBox#myWidget
{
selection-color: rgb(255, 255, 255);
color: rgb(255, 255, 255);
background-color: rgb(0, 28, 53);
font: 18pt "Arial";
border: 1px black;
border-image: url(:/Resources/down.png) 10 10 10 10;

}

QComboBox#myWidget:on
{ /*shift the text when the popup opens */
selection-background-color: rgb(108, 149, 59);
color: rgb(255, 255, 255);
}

QComboBox#myWidget :!on
{ /* shift the text when the popup opens */
selection-background-color: rgb(108, 149, 59);
color: rgb(255, 255, 255);
}

QComboBox QListView
{
background-color: rgb(0, 28, 53);
}

technoViking
21st June 2010, 23:50
Awesome thanks, when you select one of the items and its the only thing showing in the combo box (no drop down), is the text white or black?

I'm still having issues

wladek
21st June 2010, 23:57
Hi,

The text is always white for me.
Please post some screenshots and the exact qss code you are using.

Regards,
Wladek.


Awesome thanks, when you select one of the items and its the only thing showing in the combo box (no drop down), is the text white or black?

I'm still having issues