Ejemplo n.º 1
0
    def drawShape(self, painter):
        borderWidth = 1
        x = borderWidth / 2.0
        y = borderWidth / 2.0
        w = self.width() - borderWidth
        h = self.height() - borderWidth

        # round radius and outline width
        if self.height() < self.width():
            rr = self.height() * 0.20
            ow = self.height() * 0.33
        else:
            rr = self.width() * 0.20
            ow = self.width() * 0.33

        pathOuter = QtGui.QPainterPath()
        pathOuter.addRoundedRect(QtCore.QRectF(x, y, w, h), rr, rr)

        innX = x + ow
        innY = y + ow
        innW = w - (ow * 2)
        innH = h - (ow * 2)
        innR = rr * 0.2
        pathInner = QtGui.QPainterPath()
        pathInner.addRoundedRect(QtCore.QRectF(innX, innY, innW, innH), innR,
                                 innR)

        self.drawPathWithBorder(painter, pathOuter - pathInner, borderWidth)
Ejemplo n.º 2
0
    def drawShape(self, painter):
        borderWidth = 1
        x = borderWidth / 2.0
        y = borderWidth / 2.0
        w = self.width() - borderWidth
        h = self.height() - borderWidth

        path = QtGui.QPainterPath()
        path.addEllipse(QtCore.QRectF(x, y, w, h))
        self.drawPathWithBorder(painter, path, borderWidth)
Ejemplo n.º 3
0
    def drawShape(self, painter):
        borderWidth = 1
        x = borderWidth / 2.0
        y = borderWidth / 2.0
        w = self.width() - borderWidth
        h = self.height() - borderWidth

        path = QtGui.QPainterPath()
        path.addEllipse(QtCore.QRectF(x, y, w, h))

        if self.height() < self.width():
            ow = self.height() * 0.25
        else:
            ow = self.width() * 0.25

        innX = x + ow
        innY = y + ow
        innW = w - (ow * 2)
        innH = h - (ow * 2)
        pathInner = QtGui.QPainterPath()
        pathInner.addEllipse(QtCore.QRectF(innX, innY, innW, innH))
        self.drawPathWithBorder(painter, path - pathInner, borderWidth)
Ejemplo n.º 4
0
    def drawShape(self, painter):
        borderWidth = 1
        x = borderWidth / 2.0
        y = borderWidth / 2.0
        w = self.width() - borderWidth
        h = self.height() - borderWidth

        # round radius
        if self.height() < self.width():
            rr = self.height() * 0.20
        else:
            rr = self.width() * 0.20

        path = QtGui.QPainterPath()
        path.addRoundedRect(QtCore.QRectF(x, y, w, h), rr, rr)
        self.drawPathWithBorder(painter, path, borderWidth)