Exemplo n.º 1
0
 def paintEvent(self, event):
     """overrides paint event to handle text"""
     qp = QPainter()
     qp.begin(self)
     if self.main.drawValues():
         self.drawText(event, qp)
     qp.end()
Exemplo n.º 2
0
    def paintEvent(self, event):
        img = self.image
        self.zoom = self.bZoom.isChecked()
        if img.width() > 256:
            self.zoom = False
            self.bZoom.setChecked(False)
        if self.zoom:
            img = self.image.scaledToWidth(self.image.width() * 2)
        painter = QPainter()
        painter.begin(self)

        painter.drawImage(self.image_frame.x(), self.image_frame.y(), img)

        i = 0
        for poly in self.polylist:
            if i + 1 == self.polylistindex:
                pen = QPen(Qt.red, 2)
            else:
                pen = QPen(Qt.black, 2)
            i = i + 1
            painter.setPen(pen)
            lastdp = None
            for qp in poly.vertices():
                qpz = copy.copy(qp)
                if self.zoom:
                    qpz.setX(qpz.x() * 2)
                    qpz.setY(qpz.y() * 2)

                adp = self.image_frame.mapToParent(qpz)
                if not lastdp is None:
                    painter.drawLine(lastdp, adp)
                lastdp = adp
        painter.end()
Exemplo n.º 3
0
 def paintEvent(self, event):
     painter = QPainter()
     painter.begin(self)
     for i in range(2):
         img = self.image[i]
         painter.drawImage(self.frame[i].x(), self.frame[i].y(), img)
     painter.end()
Exemplo n.º 4
0
 def paintEvent(self, ev):
     if self._background_image:
         # draw background image if any (should be mostly transparent!)
         painter = QPainter()
         painter.begin(self.viewport())
         painter.drawPixmap(self._background_image_area,
                            self._background_image)
         painter.end()
     QTextBrowser.paintEvent(self, ev)