Esempio n. 1
0
 def shape(self):
     bound = QPainterPath()
     rotMatrix = QTransform().rotate(self.angle)
     poly = QPolygonF([
         QPointF(0, 0),
         QPointF(self.w, 0),
         QPointF(self.w, self.h),
         QPointF(0, self.h),
     ])
     poly = rotMatrix.map(poly)
     bound.addPolygon(poly)
     return bound
Esempio n. 2
0
    def italic_block(self, start, width, h):
        slope = 0.3

        # The QPoint below are ordered this way :
        #   1__2
        #  /  /
        # 4__3

        pts = []
        pts.append(QPointF(start + h*slope,2))
        pts.append(QPointF(start + h*slope + width,2))
        pts.append(QPointF(start + 1 + width,h-1))
        pts.append(QPointF(start + 1,h-1))
        pts.append(pts[0]) # Closes the path

        qpp = QPainterPath()
        qpp.addPolygon(QPolygonF(pts))
        return qpp