Qt5: Styling the checkbox of a checkable QTreeWidgetItem
-
In my app I have stylesheets for
QCheckBox. I created aQTreeViewWidgetwithQTreeWidgetItemsthat has been made checkable by setting the flagQt::ItemIsUserCheckable.I was expecting that the checkbox that is displayed will by styled according to the already existing
QCheckBoxstyles. Unfortunately that doesn't happen. This begs the question: how to 'access' that checkbox of theQTreeWidgetItems?I tried
QTreeView::itemas well asQTreeView::indicatorand also the combinationQTreeView::item::indicator, none of which seem to function. So what is the correct syntax? -
As it turned out, one must explicitly say
QTreeView::indicator:uncheckedin order to set the general settings like background color for this checkbox. That was a bit surprising, as this is not needed for instance forQCheckbox::indicatororQGroupBox::indicator, but the solution is now here for posterity