示例#1
0
 def paintEvent(self, ev):
     r = self.rect()
     painter = QPainter(self)
     painter.setRenderHint(QPainter.RenderHint.SmoothPixmapTransform, True)
     icon = get_icon('busy.svg' if self.running else DOWNLOAD_ICON_NAME)
     pmap = icon.pixmap(r.width(), r.height())
     x = (r.width() - int(pmap.width() / pmap.devicePixelRatio())) // 2
     y = (r.height() - int(pmap.height() / pmap.devicePixelRatio())) // 2 + 1
     painter.drawPixmap(x, y, pmap)
示例#2
0
文件: utils.py 项目: kovidgoyal/vise
 def rotated_by(self, pixmap, angle):
     ans = pixmap.copy()
     ans.fill(Qt.GlobalColor.transparent)
     p = QPainter(ans)
     p.setRenderHint(QPainter.RenderHint.SmoothPixmapTransform)
     p.setRenderHint(QPainter.RenderHint.Antialiasing)
     sz = ans.size().width() / ans.devicePixelRatio()
     p.translate(sz // 2, sz // 2)
     p.rotate(angle)
     p.translate(-sz // 2, -sz // 2)
     p.drawPixmap(0, 0, pixmap)
     p.end()
     return ans
示例#3
0
    def paintEvent(self, event):
        qp = QPainter()
        qp.begin(self)
        if self.lit:
            qp.setBrush(HIGHLIGHTBRUSH)
            qp.drawRect(self.__answerbarrect)
        if self.arrowhints and self.parent().alex:
            qp.setBrush(CORRECTBRUSH)
            qp.drawRect(self.__correctrect)
            qp.setBrush(INCORRECTBRUSH)
            qp.drawRect(self.__incorrectrect)
            qp.setBrush(HIGHLIGHTBRUSH)
            qp.drawPixmap(self.__leftarrowrect, self.__leftarrowimage)
            qp.drawPixmap(self.__rightarrowrect, self.__rightarrowimage)

        if self.spacehints and self.parent().alex:
            qp.setBrush(HIGHLIGHTBRUSH)
            qp.drawPixmap(self.__leftarrowrect, self.__spaceimage)
            qp.drawPixmap(self.__rightarrowrect, self.__spaceimage)
示例#4
0
 def paintEvent(self, event):
     painter = QPainter()
     painter.begin(self)
     painter.setOpacity(self.pixmap_opacity)
     painter.drawPixmap(0, 0, self.old_pixmap)
     painter.end()