PDA

View Full Version : QComboBox and style sheets



Krieger
21st March 2014, 10:02
I'm having a small problem with QComboBox and style sheets. In the style sheet I try to change the color of the text and arrow when QComboBox is expanded. When collapsed both text and arrow is red, but when expanded only the color of the arrow changes to yellow.



QComboBox {
color: red;
}

QComboBox:on {
color: yellow;
}




MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
QFile file(":/qss/style.qss");
file.open(QFile::ReadOnly);
setStyleSheet(file.readAll());

QComboBox *comboBox = new QComboBox(this);
comboBox->setEditable(false);
comboBox->addItem("one");
comboBox->addItem("two");
comboBox->addItem("three");
}

Any ideas what I'm doing wrong here?