Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt4 import QtCore, QtGui
- 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):
- super(StatusWidgetBar, self).paintEvent(event)
- painter = QtGui.QPainter(self)
- progressBarStyleOption = QtGui.QStyleOptionProgressBar()
- progressBarStyleOption.rect = QtCore.QRect(0, 0, (self.width()), self.height())
- progressBarStyleOption.minimum = 0
- progressBarStyleOption.maximum = self.count()
- progressBarStyleOption.textAlignment = QtCore.Qt.AlignCenter
- progressBarStyleOption.progress = self.currentIndex()
- progressBarStyleOption.textVisible = True
- painter.setOpacity(0.5)
- QtGui.qApp.style().drawControl(QtGui.QStyle.CE_ProgressBar, progressBarStyleOption, painter)
- app = QtGui.QApplication([])
- w = StatusWidgetBar()
- w.show()
- app.exec_()
Advertisement
Add Comment
Please, Sign In to add comment