Skip to content

Commit 950fc29

Browse files
authored
Merge pull request #284 from ales-erjavec/action-shortcuts-hidden-menubar
[FIX] Widget shortcuts now work even if menu bar is not visible
2 parents 6de8d8f + e882983 commit 950fc29

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

orangewidget/widget.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ def __new__(cls, *args, captionTitle=None, **kwargs):
355355
self.__statusbar_action = None # type: Optional[QAction]
356356
self.__menubar_action = None
357357
self.__menubar_visible_timer = None
358+
self.__toggle_control_area_action = None
358359

359360
# this action is enabled by the canvas framework
360361
self.__help_action = QAction(
@@ -402,8 +403,6 @@ def __new__(cls, *args, captionTitle=None, **kwargs):
402403
self.__visual_settings_action.setEnabled(True)
403404
self.__visual_settings_action.setVisible(True)
404405

405-
self.addAction(self.__help_action)
406-
407406
self.__copy_action = QAction(
408407
"Copy to Clipboard", self, objectName="action-copy-to-clipboard",
409408
shortcut=QKeySequence.Copy, enabled=False, visible=False
@@ -530,7 +529,7 @@ def __new__(cls, *args, captionTitle=None, **kwargs):
530529
helpaction.menu().addAction(self.__quick_help_action)
531530

532531
if self.__splitter is not None and self.__splitter.count() > 1:
533-
action = QAction(
532+
self.__toggle_control_area_action = action = QAction(
534533
"Show Control Area", self,
535534
objectName="action-show-control-area",
536535
shortcut=QKeySequence("Ctrl+Shift+D"),
@@ -545,6 +544,21 @@ def __new__(cls, *args, captionTitle=None, **kwargs):
545544
if self.__menubar_action is not None:
546545
viewaction.menu().addAction(self.__menubar_action)
547546

547+
actions = (
548+
self.__help_action,
549+
self.__report_action,
550+
self.__save_image_action,
551+
self.__reset_action,
552+
self.__visual_settings_action,
553+
self.__copy_action,
554+
self.__minimize_action,
555+
self.__close_action,
556+
self.__menubar_action,
557+
self.__quick_help_action,
558+
self.__toggle_control_area_action,
559+
)
560+
self.addActions(list(filter(None, actions)))
561+
548562
if self.controlArea is not None:
549563
# Otherwise, the first control has focus
550564
self.controlArea.setFocus(Qt.OtherFocusReason)

0 commit comments

Comments
 (0)