Repository: biolab/orange3

Issue:
Selection of multiple objects (nodes, annotations, arrows) is not always visible
<!--
This is an issue template. Please fill in the relevant details in the
sections below.
-->
##### Orange version

<!-- From menu _Help→About→Version_ or code `Orange.version.full_version` -->

3.3.5
##### Expected bahavior

cmd + click to select multiple objects should highlight each object
##### Actual behavior

when selecting certain objects, (especially multiple arrows and textboxes) objects often appear "unselected" but when moving the objects they are apparently selected. 
##### Steps to reproduce the behavior

try selecting multiple objects (nodes, textboxes, and arrows) and drag them around.
##### Additional info (worksheets, data, screenshots, ...)

thanks @astaric for helping me clarify the problem



Discussion:
I am not sure to which part of the program are you referring as main view. In canvas (workflow editor), I can select (and unselect) multiple widgets using the CMD click.

@astaric to clarify:

I cannot select multiple "text" or "arrow" objects with cmd + click. 

I'll edit the issue comment to clarify.

Can you try cmd clicking multiple arrows and then move one of them. When I try to do this, all of the selected arrows move.


Resolving patch:
diff --git a/Orange/canvas/canvas/items/annotationitem.py b/Orange/canvas/canvas/items/annotationitem.py
--- a/Orange/canvas/canvas/items/annotationitem.py
+++ b/Orange/canvas/canvas/items/annotationitem.py
@@ -107,8 +107,9 @@ def __init__(self, parent=None, **kwargs):
         self.__textMargins = (2, 2, 2, 2)
 
         rect = self.geometry().translated(-self.pos())
+        self.__framePen = QPen(Qt.NoPen)
         self.__framePathItem = QGraphicsPathItem(self)
-        self.__framePathItem.setPen(QPen(Qt.NoPen))
+        self.__framePathItem.setPen(self.__framePen)
 
         self.__textItem = GraphicsTextEdit(self)
         self.__textItem.setPlaceholderText(self.tr("Enter text here"))
@@ -137,14 +138,15 @@ def adjustSize(self):
     def setFramePen(self, pen):
         """Set the frame pen. By default Qt.NoPen is used (i.e. the frame
         is not shown).
-
         """
-        self.__framePathItem.setPen(pen)
+        if pen != self.__framePen:
+            self.__framePen = QPen(pen)
+            self.__updateFrameStyle()
 
     def framePen(self):
         """Return the frame pen.
         """
-        return self.__framePathItem.pen()
+        return QPen(self.__framePen)
 
     def setFrameBrush(self, brush):
         """Set the frame brush.
@@ -156,6 +158,14 @@ def frameBrush(self):
         """
         return self.__framePathItem.brush()
 
+    def __updateFrameStyle(self):
+        if self.isSelected():
+            pen = QPen(QColor(96, 158, 215), 1.25, Qt.DashDotLine)
+        else:
+            pen = self.__framePen
+
+        self.__framePathItem.setPen(pen)
+
     def setPlainText(self, text):
         """Set the annotation plain text.
         """
@@ -285,10 +295,7 @@ def sceneEventFilter(self, obj, event):
 
     def itemChange(self, change, value):
         if change == QGraphicsItem.ItemSelectedHasChanged:
-            if self.isSelected():
-                self.setFramePen(QPen(Qt.DashDotLine))
-            else:
-                self.setFramePen(QPen(Qt.NoPen))
+            self.__updateFrameStyle()
 
         return Annotation.itemChange(self, change, value)
 
@@ -544,7 +551,7 @@ def setColor(self, color):
         """
         if self.__color != color:
             self.__color = QColor(color)
-            self.__updateBrush()
+            self.__updateStyleState()
 
     def color(self):
         """
@@ -595,17 +602,24 @@ def shape(self):
 
     def itemChange(self, change, value):
         if change == QGraphicsItem.ItemSelectedHasChanged:
-            self.__updateBrush()
+            self.__updateStyleState()
 
         return Annotation.itemChange(self, change, value)
 
-    def __updateBrush(self):
+    def __updateStyleState(self):
         """
-        Update the arrow brush.
+        Update the arrows' brush, pen, ... based on it's state
         """
         if self.isSelected():
             color = self.__color.darker(150)
+            pen = QPen(QColor(96, 158, 215), Qt.DashDotLine)
+            pen.setWidthF(1.25)
+            pen.setCosmetic(True)
+            self.__shadow.setColor(pen.color().darker(150))
         else:
             color = self.__color
+            pen = QPen(Qt.NoPen)
+            self.__shadow.setColor(QColor(63, 63, 63, 180))
 
         self.__arrowItem.setBrush(color)
+        self.__arrowItem.setPen(pen)


Test patch: