From 8b0d663fd0dbd19eeb6d52b1d1a42866cd9434a6 Mon Sep 17 00:00:00 2001 From: Abdo Date: Sat, 16 Sep 2023 04:28:20 +0300 Subject: [PATCH] Allow full screen mode on new Qt6 drivers (#2660) * Allow full screen mode on new Qt6 drivers * Update fulscreen warning message --- ftl/core/actions.ftl | 2 +- qt/aqt/main.py | 2 +- qt/aqt/utils.py | 12 +++--------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/ftl/core/actions.ftl b/ftl/core/actions.ftl index d7264a74c..f7157cbe3 100644 --- a/ftl/core/actions.ftl +++ b/ftl/core/actions.ftl @@ -55,7 +55,7 @@ actions-previous-card-info = Previous Card Info # By convention, the name of a menu action is suffixed with "..." if additional # input is required before it can be performed. E.g. "Export..." vs. "Delete". actions-with-ellipsis = { $action }... -actions-currently-unsupported = This action is currently not supported on your system. +actions-fullscreen-unsupported = Full screen mode is not supported for your video driver. Try switching to a different one from the preferences screen. ## Flags diff --git a/qt/aqt/main.py b/qt/aqt/main.py index df25ac058..b65d448f8 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -1365,7 +1365,7 @@ title="{}" {}>{}""".format( def on_toggle_full_screen(self) -> None: if disallow_full_screen(): showWarning( - tr.actions_currently_unsupported(), + tr.actions_fullscreen_unsupported(), parent=self, help=HelpPage.FULL_SCREEN_ISSUE, ) diff --git a/qt/aqt/utils.py b/qt/aqt/utils.py index 8b0f833d9..ea2a5b77f 100644 --- a/qt/aqt/utils.py +++ b/qt/aqt/utils.py @@ -1074,19 +1074,13 @@ def qtMenuShortcutWorkaround(qmenu: QMenu) -> None: def disallow_full_screen() -> bool: - """Test for OpenGl on Windows, which is known to cause issues with full screen mode. - On Qt6, the driver is not detectable, so check if it has been set explicitly. - """ + """Test for OpenGl on Windows, which is known to cause issues with full screen mode.""" from aqt import mw from aqt.profiles import VideoDriver return is_win and ( - (qtmajor == 5 and mw.pm.video_driver() == VideoDriver.OpenGL) - or ( - qtmajor == 6 - and not os.environ.get("ANKI_SOFTWAREOPENGL") - and os.environ.get("QT_OPENGL") != "software" - ) + mw.pm.video_driver() == VideoDriver.OpenGL + and not os.environ.get("ANKI_SOFTWAREOPENGL") )