Commits

Aleš Erjavec committed b5cc482

Remove cluster selection when clicking outside the dendrogram tree.

(fixes #1343)

  • Participants
  • Parent commits 312265a

Comments (0)

Files changed (2)

File Orange/OrangeWidgets/OWClustering.py

         if event.type() == QEvent.LayoutRequest:
             self.emit(SIGNAL("dendrogramLayoutChanged()"))
         return ret
-    
+
+    def mousePressEvent(self, event):
+        QGraphicsWidget.mousePressEvent(self, event)
+        if event.modifiers() == Qt.NoModifier and self.selected_items:
+            self.set_selected_clusters([])
+
     if DEBUG:
         def paint(self, painter, options, widget=0):
             rect =  self.geometry()

File Orange/OrangeWidgets/Unsupervised/OWHierarchicalClustering.py

                 self.grid_widget.sizeHint(Qt.PreferredSize)
             )
 
+    def mousePressEvent(self, event):
+        QGraphicsScene.mousePressEvent(self, event)
+        if event.modifiers() == Qt.NoModifier:
+            pos = self.widget.mapFromScene(event.pos())
+            if not self.widget.contains(pos) and self.widget.selected_items:
+                self.widget.set_selected_clusters([])
+
     def _update_scene_rect(self):
         items_rect = reduce(QRectF.united,
                             [item.sceneBoundingRect()