def paint(self, painter, option, index): painter.save() opt = QStyleOptionButton() opt.text = str(index.data()) opt.rect = option.rect opt.palette = option.palette opt.state = QStyle.State_Enabled | QStyle.State_Raised QApplication.style().drawControl(QStyle.CE_PushButton, opt, painter) painter.restore()
def paint(self, painter, option, index): painter.save() opt = QStyleOptionButton() opt.text = str(index.data()) opt.rect = option.rect opt.palette = option.palette task = self.__taskStorage.getTaskByNum(index.row()) if task.state != "RUN": opt.state = QStyle.State_Enabled | QStyle.State_Raised else: opt.state = QStyle.State_Enabled | QStyle.State_Sunken QApplication.style().drawControl(QStyle.CE_PushButton, opt, painter) painter.restore()