Exemplo n.º 1
0
    def itemChange(self, change, value):
        """docstring for itemChange

        Arguments:
            change (GraphicsItemChange): see http://doc.qt.io/qt-5/qgraphicsitem.html#GraphicsItemChange-enum
            value (QVariant): resolves in Python as an integer
        """
        # logger.debug("ps itemChange")
        if change == QGraphicsItem.ItemSelectedChange:
            # logger.debug("isc", value)
            if value == False:  # noqa
                self.clearSelection(False)
                return False
            else:
                return True
        elif change == QGraphicsItem.ItemChildAddedChange:
            # logger.debug("icac")
            if self._added_to_press_list is False:
                # logger.debug("kid added")
                self.setFocus()  # this is to get delete keyPressEvents
                self.selectionbox.boxParent()
                # self.setParentItem(self.selectionbox.boxParent())
                self._added_to_press_list = True
                self.scene().views()[0].addToPressList(self)
            return
        return QGraphicsItemGroup.itemChange(self, change, value)
Exemplo n.º 2
0
    def itemChange(self, change, value):
        """docstring for itemChange

        Arguments:
            change (GraphicsItemChange): see http://doc.qt.io/qt-5/qgraphicsitem.html#GraphicsItemChange-enum
            value (QVariant): resolves in Python as an integer
        """
        # print("ps itemChange")
        if change == QGraphicsItem.ItemSelectedChange:
            # print("isc", value)
            if value == False:  # noqa
                self.clearSelection(False)
                return False
            else:
                return True
        elif change == QGraphicsItem.ItemChildAddedChange:
            # print("icac")
            if self._added_to_press_list is False:
                # print("kid added")
                self.setFocus()  # this is to get delete keyPressEvents
                self.selectionbox.boxParent()
                # self.setParentItem(self.selectionbox.boxParent())
                self._added_to_press_list = True
                self.scene().views()[0].addToPressList(self)
            return
        return QGraphicsItemGroup.itemChange(self, change, value)
Exemplo n.º 3
0
 def itemChange(self, change, value):
     """docstring for itemChange"""
     if change == QGraphicsItem.ItemSelectedChange:
         if value == False:
             self.clearSelection(False)
             return False
         else:
             return True
     elif change == QGraphicsItem.ItemChildAddedChange:
         if self._added_to_press_list == False:
             # print "kid added"
             self.setFocus()  # this is to get delete keyPressEvents
             self.setParentItem(self.selectionbox.boxParent())
             self._added_to_press_list = True
             self.scene().views()[0].addToPressList(self)
         return
     return QGraphicsItemGroup.itemChange(self, change, value)
Exemplo n.º 4
0
 def itemChange(self, change, value):
     """docstring for itemChange"""
     if change == QGraphicsItem.ItemSelectedChange:
         if value == False:
             self.clearSelection(False)
             return False
         else:
             return True
     elif change == QGraphicsItem.ItemChildAddedChange:
         if self._added_to_press_list == False:
             # print "kid added"
             self.setFocus()  # this is to get delete keyPressEvents
             self.setParentItem(self.selectionbox.boxParent())
             self._added_to_press_list = True
             self.scene().views()[0].addToPressList(self)
         return
     return QGraphicsItemGroup.itemChange(self, change, value)
Exemplo n.º 5
0
 def itemChange(self, change, value):
     if change == QGraphicsItem.ItemPositionChange and self.scene():
         command = CommandMoveItem(self, value)
         self.scene().undoStack.push(command)
     return QGraphicsItemGroup.itemChange(self, change, value)