Is there a way I could increase the height of the items, which are listed in a QComboBox control ?
I tried following as suggested here in QTDevNet forums but with no luck
QComboBox QAbstractItemView::item {margin-top: 3px;}
I also tried this, still with no result.
QComboBox QAbstractItemView::item {min-height: 20px;}
Is it possible to achieve this at style-sheet level at all ?
An alternative solution would be:
ui->comboBox->model()->setData(ui->comboBox->model()->index(-row-, 0), QSize(-width-, -height-), Qt::SizeHintRole);
, where
-row-
is zero-based item index;-width-
and-height-
stand for item width hint and height hint, respectively.Your style sheet seemed correct, so I tried it. It seems the problem is similar to this one on Qt centre:
If you replace the default delegate by a QStyledItemDelegate, your style sheet should work:
QComboBox::item
worked for meSo for example, I was trying to change the color of the item when it was disabled, and the following code did the trick.
This one did not work:
Instead I used: