Skip to content

Commit

Permalink
Drop Handler: Add title to popup for widget selection
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed Nov 11, 2023
1 parent cbf2e9a commit 85aae6b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion orangecanvas/document/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from AnyQt.QtWidgets import (
QApplication, QGraphicsRectItem, QGraphicsSceneMouseEvent,
QGraphicsSceneContextMenuEvent, QWidget, QGraphicsItem,
QGraphicsSceneDragDropEvent, QMenu, QAction
QGraphicsSceneDragDropEvent, QMenu, QAction, QWidgetAction, QLabel
)
from AnyQt.QtGui import QPen, QBrush, QColor, QFontMetrics, QKeyEvent, QFont
from AnyQt.QtCore import (
Expand Down Expand Up @@ -2089,7 +2089,15 @@ def doDrop(
if len(self.__accepts) == 1:
ep, handler = self.__accepts[0]
elif len(self.__accepts) > 1:
class Title(QWidgetAction):
def createWidget(self, parent):
return QLabel("<b>Select a widget</b>", parent, margin=2)

menu = QMenu(event.widget())
menu.addAction(Title(menu))
separator = QAction()
separator.setSeparator(True)
menu.addAction(separator)
for ep_, handler_ in self.__accepts:
ac = action_for_handler(handler_, document, event)
if ac is None:
Expand Down

0 comments on commit 85aae6b

Please sign in to comment.