PDA

View Full Version : Styling QComoBox using CSS Stylesheet



bjoernbg
2nd January 2008, 15:33
Hello everyone,

I've got a very strange problem. I'm trying to style a QComboBox using a stylesheet that looks like this:


QComboBox {
border: 1px solid #333333;
border-radius: 3px;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #797979, stop:0.48 #696969, stop:0.52 #5e5e5e, stop:1 #4f4f4f);
padding: 1px 23px 1px 3px;
min-width: 6em;
color: #ffffff;
}
QComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 20px;

border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
QComboBox::down-arrow {
image: url(:/images/combobox-arrow.png);
}

QComboBox QAbstractView{
background-color: #4f4f4f;
color: #999999;

selection-background-color: #999999;
selection-color: #4f4f4f;
}

The Combobox looks very nice as long as I don't press it. The Menu, that pops up then is totally messed up - it's got completely black background and an ugly border. Nothing I do seems to change this much.

I also tried to use the exact stylesheet that trolltech gives as an example for styling a combobox, but that results in the same problem.

I hope someone can help me. I'm on a Mac here if that makes a difference (shouldnt, but might ;) )

Thanks in advance for any help!

Björn

Smokex
6th October 2010, 23:12
It's not QAbstractView. It's QAbstractItemView.