Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Styling QCheckBox inside QComboBox with stylesheet
Qt 6.11 is out! See what's new in the release blog

Styling QCheckBox inside QComboBox with stylesheet

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Olyver
    wrote on last edited by
    #1

    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 !

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved