Details
-
Bug
-
Resolution: Duplicate
-
P3: Somewhat important
-
None
-
5.12.0
-
None
-
Ubuntu 18.04
Description
I am trying to create a QComboBox with items that contain checkboxes. I followed the solution posted here and converted the PyQt portions to work with PySide2. If I set the QApplication style to be 'windows', then the checkboxes appear but if I use the 'fusion' style, the checkboxes are hidden.
The relevant code snippet that creates the QComboBox:
self._combo = QtWidgets.QComboBox()
self._combo.setModel(QtGui.QStandardItemModel())
for i in range(3):
item = QtGui.QStandardItem(str(i))
item.setFlags(QtCore.Qt.ItemIsEnabled |
QtCore.Qt.ItemIsUserCheckable)
item.setData(QtCore.Qt.Unchecked, QtCore.Qt.CheckStateRole)
self._combo.model().setItem(i+1, 0, item
Note: the checkboxes are checked in the 'qcombobox-windows.png' because I had manually checked them prior to taking a screenshot.
Attachments
Issue Links
- duplicates
-
QTBUG-60310 Check Box in QComboBox is not drawn in case of "Fusion" Style
- Closed