Changeset d7fb556fa348…
Parent e2f7b799cf8f…
by
Changes to one file · Browse files at d7fb556fa348 Showing diff from parent e2f7b799cf8f Diff from another changeset...
@@ -409,6 +409,7 @@ self.setContextMenuPolicy(Qt.CustomContextMenu)
self.customContextMenuRequested.connect(self.menuRequested)
self.setTextElideMode(Qt.ElideLeft)
+ self.setItemDelegate(WctxItemDelegate())
def scrollTo(self, index, hint=QAbstractItemView.EnsureVisible):
# don't update horizontal position by selection change
@@ -703,6 +704,18 @@ def getChecked(self):
return self.checked.copy()
+class WctxItemDelegate(QItemDelegate):
+ '''Draw treeview checkboxes like standard QCheckBoxes'''
+ def drawCheck(self, painter, option, rect, state):
+ option.rect = rect
+ if state == Qt.Unchecked:
+ option.state |= QStyle.State_Off
+ elif state == Qt.Checked:
+ option.state |= QStyle.State_On
+ style = QApplication.style()
+ primitive = QStyle.PE_IndicatorCheckBox
+ return style.drawPrimitive(primitive, option, painter, None)
+
def statusMessage(status, mst, upath):
tip = ''
if status in statusTypes:
|
Loading...