Setting QComboBox stylesheet reduces hight of dropdown [SOLVED]
-
Hi all,
I want my combobox to be blue. That is achieved by setting the stylesheet:
@combo->setStyleSheet("color: blue");@There is only one downside:
Setting the above styling reduces the amount of items displayed when the combobox is clicked on the subitem list is displayed.
https://skydrive.live.com/redir?resid=47024E7C0E1A51D7!6780&v=3What can I do to set the textcolor and have all subitems of the combobox displayed when I click on the combobox.
kind regards, reinhart
-
you can try this:
@
QAbstractItemView * view = combo->view();
QPalette p = view->palette();
p.setColor(QPalette::Text,Qt::blue);
view->setPalette(p);
@
Not tested though. -
qss for combo should not affect the number of visible items
where/when do you apply the style sheet?
just in case you could control the number of max visible items, after the style sheet setting, with:
@ui->comboBox->setMaxVisibleItems(5);@
or
@ui->comboBox->setStyleSheet("qproperty-maxVisibleItems:3");@