PDA

View Full Version : Problem styling QComBox using stylesheet



sjagtap
22nd March 2010, 10:59
Hi,
I am trying to set the back-ground of combobox which is editable.
But background seems to be not working for the embedded QLineEdit control.
Following is my stylesheet implementation and I am using designer and QT 4.3


QComboBox
{
border: 1px solid;
padding: 2px 25px 2px 10px;
}

QComboBox::drop-down
{
subcontrol-origin: margin;
subcontrol-position: top right;
width: 20px;
margin-top: 2px;
border-style: solid;
border-width: 0px 0px 0px 1px;
border-color: #999999;
border-style: solid; /* just a single line */
borde-radius: 0px; /* same radius as the QComboBox */
background-color: transparent;
}

QComboBox:editable
{
color: #02174E;
border-color: #004D9F;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 red, stop:1 green);
}


I tested the above stylesheet by putting two combox controls on dialog in QT designer. One of the control is editable and enabled while other is editable but disabled.

Can anybody help me out in setting the back-ground correct in this case?

zgulser
22nd March 2010, 11:43
Access background of the combo box via QListView..

sjagtap
22nd March 2010, 13:08
I tried following

QComboBox:editable > ListView
{
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 red, stop:1 green);
}

but not working??

sjagtap
22nd March 2010, 13:10
it was typo in my earlier responce code was

QComboBox:editable > QListView
{
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 red, stop:1 green);
}


but not worked?

zgulser
22nd March 2010, 13:18
What's > there?