Esempio n. 1
0
 def rotate_selected(scene: QGraphicsScene, e: QKeyEvent):
     for item in scene.selectedItems():
         if e.key() == Qt.Key_Right:
             item.setRotation(
                 (item.rotation() + 1 +
                  (2 * (e.modifiers() == Qt.ShiftModifier))) % 360)
         elif e.key() == Qt.Key_Left:
             item.setRotation(
                 (item.rotation() - 1 -
                  (2 * (e.modifiers() == Qt.ShiftModifier))) % 360)
Esempio n. 2
0
 def rescale_selected(scene: QGraphicsScene, e: QKeyEvent):
     for item in scene.selectedItems():
         transform = item.transform()
         if e.key() == Qt.Key_W:
             transform.scale(1, 1.01)
         elif e.key() == Qt.Key_S:
             transform.scale(1, 0.99)
         elif e.key() == Qt.Key_D:
             transform.scale(1.01, 1)
         elif e.key() == Qt.Key_A:
             transform.scale(0.99, 1)
         item.setTransform(transform)
Esempio n. 3
0
 def delete_selected(scene: QGraphicsScene, gim: GraphicItemModel):
     gim.delete_all_from_references(scene.selectedItems())
     for item in scene.selectedItems():
         scene.removeItem(item)