changeset 52:67056de5da0f

Added delete key
author windel
date Sun, 08 Apr 2012 09:43:48 +0200
parents b3a65e154ab2
children 6dd7d6a1737c
files applications/lab/diagrameditor.py
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/applications/lab/diagrameditor.py	Thu Apr 05 08:01:41 2012 +0200
+++ b/applications/lab/diagrameditor.py	Sun Apr 08 09:43:48 2012 +0200
@@ -366,6 +366,7 @@
       painter.drawEllipse(20, 20, 20, 20)
       painter.end()
 
+      # Fill library:
       self.libItems = []
       self.libItems.append( QStandardItem(QIcon(pixmap), 'Block') )
       self.libItems.append( QStandardItem(QIcon(pixmap), 'Uber Unit') )
@@ -390,6 +391,11 @@
       testShortcut.activated.connect(self.test)
       zoomShortcut = QShortcut(QKeySequence("F8"), self)
       zoomShortcut.activated.connect(self.zoomAll)
+      delAction = QAction('Delete', self)
+      delAction.setShortcut(QKeySequence.Delete)
+      delShort = QShortcut(QKeySequence.Delete, self)
+      delShort.activated.connect(self.deleteItem)
+      #delAction.triggered.connect(self.deleteItem)
 
    def test(self):
       self.diagramView.rotate(11)
@@ -498,6 +504,12 @@
       """ zoom to fit all items """
       rect = self.diagramScene.itemsBoundingRect()
       self.diagramView.fitInView(rect, Qt.KeepAspectRatio)
+   def deleteItem(self):
+      print('del')
+      items = self.diagramScene.selectedItems()
+      for item in items:
+            #if type(item) is Connection:
+            print(item)
    def sceneMouseMoveEvent(self, event):
       if self.startedConnection:
          pos = event.scenePos()