diff python/diagrameditor.py @ 99:6efbeb903777

movage
author windel
date Mon, 24 Dec 2012 15:03:30 +0100
parents 4a37d6992bd3
children
line wrap: on
line diff
--- a/python/diagrameditor.py	Mon Dec 24 13:57:00 2012 +0100
+++ b/python/diagrameditor.py	Mon Dec 24 15:03:30 2012 +0100
@@ -43,7 +43,7 @@
       self.delShort = QShortcut(QKeySequence.Delete, self)
       self._model = None
       self.treeView = QTreeView()
-      self.treeView.activated.connect(self.itemActivated)
+      self.treeView.clicked.connect(self.itemActivated)
    def itemActivated(self, idx):
       b = idx.internalPointer()
       s = b.scene()
@@ -123,6 +123,8 @@
          kind, name = name.split(':')
          pos = self.mapToScene(event.pos())
          s = self.scene()
+         if not s:
+            return
          print(kind, 'name:', name)
          kind = getattr(diagramitems, kind)
          print(kind)