Ejemplo n.º 1
0
    def mousePressEvent(self, event):
        if event.button() != Qt.LeftButton:
            QGraphicsItemGroup.mousePressEvent(self, event)
        else:
            self.dragEnable = True
            self.selectionbox.resetTransform()

            # this code block is a HACK to update the boundingbox of the group
            if self.childItems()[0] != None:
                item = self.childItems()[0]
                self.removeFromGroup(item)
                item.restoreParent()
                self.addToGroup(item)

            self.selectionbox.setRect(self.boundingRect())
            self.selectionbox.drawMe = True
            self._r0 = self.getR(event.scenePos())
            self._r = self._r0
            self.scene().views()[0].addToPressList(self)
Ejemplo n.º 2
0
    def mousePressEvent(self, event):
        """ Deal with mouse press events on the area spanned
        by a PatternRepeatItem.

        We only accept mouse press events with Control key
        pressed to allow the motion of the item across the
        canvas.

        NOTE: We also change the cursor type to make the
        motion of pattern repeat items a bit more visible.

        """

        self._position = self.pos()

        if (event.modifiers() & Qt.ControlModifier):
            QApplication.setOverrideCursor(QCursor(Qt.SizeAllCursor))
        else:
            event.ignore()

        return QGraphicsItemGroup.mousePressEvent(self, event)
Ejemplo n.º 3
0
    def mousePressEvent(self, event):
        """ Deal with mouse press events on the area spanned
        by a PatternRepeatItem.

        We only accept mouse press events with Control key
        pressed to allow the motion of the item across the
        canvas.

        NOTE: We also change the cursor type to make the
        motion of pattern repeat items a bit more visible.

        """

        self._position = self.pos()

        if (event.modifiers() & Qt.ControlModifier):
            QApplication.setOverrideCursor(QCursor(Qt.SizeAllCursor))
        else:
            event.ignore()

        return QGraphicsItemGroup.mousePressEvent(self, event)