Example #1
0
    def updateArcRect(self, radius):
        """
        TOWRITE

        :param `radius`: TOWRITE
        :type `radius`: qreal
        """
        arcRect = QRectF()
        arcRect.setWidth(radius * 2.0)
        arcRect.setHeight(radius * 2.0)
        arcRect.moveCenter(QPointF(0, 0))
        self.setRect(arcRect)
    def setObjectDiameter(self, diameter):
        """
        TOWRITE

        :param `diameter`: TOWRITE
        :type `diameter`: qreal
        """
        circRect = QRectF()
        circRect.setWidth(diameter)
        circRect.setHeight(diameter)
        circRect.moveCenter(QPointF(0, 0))
        self.setRect(circRect)
        self.updatePath()
    def setObjectDiameter(self, diameter):
        """
        TOWRITE

        :param `diameter`: TOWRITE
        :type `diameter`: qreal
        """
        circRect = QRectF()
        circRect.setWidth(diameter)
        circRect.setHeight(diameter)
        circRect.moveCenter(QPointF(0, 0))
        self.setRect(circRect)
        self.updatePath()
Example #4
0
    def updateBoundingRect(self):
        margin = self.keySize * 0.5

        boundingRect = QRectF(0, 0, 0, 0)

        for key in self.keyList:
            rect = key.shape().boundingRect()
            rect.translate(key.pos())
            boundingRect = boundingRect.united(rect)

        boundingRect.setX(boundingRect.x() - margin)
        boundingRect.setY(boundingRect.y() - margin)
        boundingRect.setWidth(boundingRect.width() + margin)
        boundingRect.setHeight(boundingRect.height() + margin)
        self.keyBoundRect = boundingRect