I know how to style QComboBox
when mouse is hovering by doing:
pComboBox->setStyleSheet(pComboBox->styleSheet()+QString(\" QComboBox:hover{cs
I don't know is QSS
powerful enough to do this(I think no), but with eventfilter
you can do this very easy:
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
if (obj == ui->comboBox && event->type() == QEvent::Enter)
{
//user enters combobox, so we apply stylesheet
ui->comboBox->setStyleSheet("QComboBox::down-arrow{background-color: red}");
}
else
if(event->type() == QEvent::Leave)//user leaves combobox, so we set default settings
ui->comboBox->setStyleSheet("");
return QObject::eventFilter(obj, event);
}
To use eventFilter
you should also:
protected:
bool eventFilter(QObject *obj, QEvent *event);//in header
and
qApp->installEventFilter(this);//in constructor