blob: 0bce466c4c8fdd81b79adc349632fa0705a82c0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
//![0]
class WidgetDelegate (QStyledItemDelegate):
# ...
def paint(painter, option, index):
if index.column() == 1:
progress = index.data().toInt()
progressBarOption = QStyleOptionProgressBar()
progressBarOption.rect = option.rect
progressBarOption.minimum = 0
progressBarOption.maximum = 100
progressBarOption.progress = progress
progressBarOption.text = QString::number(progress) + "%"
progressBarOption.textVisible = True
QApplication.style().drawControl(QStyle.CE_ProgressBar, progressBarOption, painter)
else:
QStyledItemDelegate.paint(self, painter, option, index)
//![0]
|