ToDoList.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:nuke 作者: Kagarrache 项目源码 文件源码
def paintEvent(self, event):
        painter = QtGui.QPainter(self)
        painter.setRenderHint(QtGui.QPainter.Antialiasing)
        currentIndex = self.currentIndex()
        painter.setPen(QtGui.QColor(0,0,0,0))

        if currentIndex == 0:
            progress =  .1
            if self.active or self.hasFocus():
                painter.setBrush(self.colWaiting.lighter())
            else:
                painter.setBrush(self.colWaiting)
        elif currentIndex == 1:
            progress = .6
            if self.active or self.hasFocus():
                painter.setBrush(self.colInProgress.lighter())
            else:
                painter.setBrush(self.colInProgress)
        elif currentIndex == 2:
            progress = 1
            if self.active or self.hasFocus():
                painter.setBrush(self.colFinished.lighter())
            else:
                painter.setBrush(self.colFinished)
        barRect = QtCore.QRect(0, self.height() * .25, (self.width()) * progress, self.height() * .5)
        painter.drawRect(barRect)

        outline = QtCore.QRect(1, self.height() * .25, (self.width())-2, self.height() * .5)
        painter.setBrush(QtGui.QColor(0,0,0,0))
        painter.setPen(QtGui.QColor(0,0,0,255))
        painter.drawRect(outline)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号