# HG changeset patch # User windel # Date 1333871028 -7200 # Node ID 67056de5da0fd524210fba4cae0705894570aca6 # Parent b3a65e154ab2961f8fdedb0cc7239272bfc3d5b7 Added delete key diff -r b3a65e154ab2 -r 67056de5da0f applications/lab/diagrameditor.py --- 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()