Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class StatusWidgetBar(QtGui.QComboBox):
- def __init__(self, parent=None):
- super(StatusWidgetBar, self).__init__(parent)
- self.setToolTip('status (click to edit)')
- self.addItems(['waiting', 'in progress', 'finished'])
- def paintEvent(self, event):
- painter = QtGui.QPainter(self)
- painter.setRenderHint(QtGui.QPainter.Antialiasing)
- parent = self.parentWidget()
- progress = self.currentIndex() * .5
- painter.setPen(QtGui.QColor(0,0,0,0))
- if progress <= .5:
- painter.setBrush(QtGui.QColor(255, 140, 30))
- else:
- painter.setBrush(QtGui.QColor('darkGreen'))
- barRect = QtCore.QRect(0, 0, (self.width()) * progress, self.height())
- painter.drawRect(barRect)
Advertisement
Add Comment
Please, Sign In to add comment