From e405e908db2e883246729dba61ee2a3e875819b1 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Sun, 28 Aug 2022 12:00:10 +0200 Subject: [PATCH] use different constructor to more reliably set the parent for menus and actions This may make rendering menus more stable on hi-dpi monitors. It worked before, but sometimes it had some weird glitches. --- src/mainwindow.py | 3 ++- src/plugins/domain/raction.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.py b/src/mainwindow.py index ed41569..2419c61 100644 --- a/src/mainwindow.py +++ b/src/mainwindow.py @@ -67,7 +67,8 @@ class MainWindow(QMainWindow): ] for (menu_id, menu_label) in known_menus: - menu = QMenu(menu_label, self) + menu = QMenu(self) + menu.setTitle(menu_label) mcs: [MenuContribution] = [mc for mc in menu_contributions if mc.menu_id == menu_id] if len(mcs) == 0: continue diff --git a/src/plugins/domain/raction.py b/src/plugins/domain/raction.py index af9ab3f..398c896 100644 --- a/src/plugins/domain/raction.py +++ b/src/plugins/domain/raction.py @@ -76,7 +76,8 @@ class RAction(): self._action.setText(label) def to_qaction(self, qmenu: QMenu) -> QAction: - action = QAction(self.label, qmenu) + action = QAction(qmenu) + action.setText(self.label) self._action = action if self.icon_from_theme: action.setIcon(Icon.fromTheme(self.icon_from_theme))