From ff073445af3e278c1f9fa0cdac51a5ab99f8248f Mon Sep 17 00:00:00 2001 From: Rebecca Breu Date: Sun, 18 Apr 2021 16:39:27 +0200 Subject: [PATCH] Action for toggling always on top mode --- beeref/actions/actions.py | 6 ++++++ beeref/actions/menu_structure.py | 1 + beeref/view.py | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/beeref/actions/actions.py b/beeref/actions/actions.py index 5681776..697d4d4 100644 --- a/beeref/actions/actions.py +++ b/beeref/actions/actions.py @@ -194,4 +194,10 @@ actions = [ 'checkable': True, 'callback': 'on_action_fullscreen', }, + { + 'id': 'always_on_top', + 'text': '&Always On Top', + 'checkable': True, + 'callback': 'on_action_always_on_top', + }, ] diff --git a/beeref/actions/menu_structure.py b/beeref/actions/menu_structure.py index 13a48a5..ba843e1 100644 --- a/beeref/actions/menu_structure.py +++ b/beeref/actions/menu_structure.py @@ -48,6 +48,7 @@ menu_structure = [ 'fit_selection', MENU_SEPARATOR, 'fullscreen', + 'always_on_top', 'show_scrollbars', ], }, diff --git a/beeref/view.py b/beeref/view.py index b983980..92616c4 100644 --- a/beeref/view.py +++ b/beeref/view.py @@ -148,6 +148,13 @@ class BeeGraphicsView(QtWidgets.QGraphicsView, ActionsMixin): else: self.parent().showNormal() + def on_action_always_on_top(self, checked): + self.parent().setWindowFlag( + Qt.WindowFlags.WindowStaysOnTopHint, on=checked) + self.parent().destroy() + self.parent().create() + self.parent().show() + def on_action_show_scrollbars(self, checked): if checked: self.setHorizontalScrollBarPolicy(