Styling QCheckBox inside QComboBox with stylesheet



  • Hello everyone,

    My question is about styling using StyleSheet.

    I'm using a QStandardItemModel and populates it with QStandardItem with flag Qt::ItemIsUserCheckable.
    That way, a checkbox appears next to each of my items in the QComboBox.

    I would like now to style these checkboxes like all the others in my program. (the checked and unchecked indicators)

    No success so far; I tried stuffs like the following without luck:
    @
    MyCustomComboBox::init(){
    ...
    setItemDelegate(new QStyledItemDelegate());
    setStyleSheet(
    "QComboBox QAbstractItemView::item::QCheckBox::indicator:checked{"
    " image: url(...);"
    "}"
    );
    }
    @

    If you know a way to to it without implementing a delegate, I'd be happy to hear about it.

    Thanks !


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.