grigoryvp
grigoryvp

Reputation: 42593

How to modify style of individual items in QComboBox?

Given a QComboBox widget, i can easily change style for drop-down list. Foe example, this style sheet adds green border for drop down list:

QComboBox QAbstractItemView { border: 5px solid green; }

enter image description here

But if i try to change style for individual items, it simply doesn't work:

QComboBox QAbstractItemView::item { border: 5px solid green; }

enter image description here

is it possible to change style for individual list items in QComboBox, or it's not supported?

Upvotes: 0

Views: 893

Answers (1)

Blood
Blood

Reputation: 4196

Yup, you can do it. All what you need is to use QAbstractItemDelegate. To use it just call QComboBox::setItemDelegate()

Upvotes: 1

Related Questions