QComboBox field markup

I want to create mine QComboBox

tagged for dropdowns. This is how it looks now:

enter image description here

And I would like something like this:

enter image description here

I tried with

QComboBox QAbstractItemView::item {
    margin: 3px;
}

      

but that won't work.

Can you help me?

+3


source to share


1 answer


You want to set some space between items.I try different stylesheets, but I can't get the result. But I found this solution. Perhaps it helps.

    ui->comboBox->setView(new QListView());
ui->comboBox->setStyleSheet("QComboBox QAbstractItemView::item { min-height: 35px; min-width: 50px; }QListView::item:selected { color: black; background-color: lightgray}");

      



The result is very similar enter image description here

+10


source







All Articles