Allow full screen mode on new Qt6 drivers (#2660)

* Allow full screen mode on new Qt6 drivers

* Update fulscreen warning message
This commit is contained in:
Abdo 2023-09-16 04:28:20 +03:00 committed by GitHub
parent 30ae9f7c54
commit 8b0d663fd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 11 deletions

View file

@ -55,7 +55,7 @@ actions-previous-card-info = Previous Card Info
# By convention, the name of a menu action is suffixed with "..." if additional # 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". # input is required before it can be performed. E.g. "Export..." vs. "Delete".
actions-with-ellipsis = { $action }... 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 ## Flags

View file

@ -1365,7 +1365,7 @@ title="{}" {}>{}</button>""".format(
def on_toggle_full_screen(self) -> None: def on_toggle_full_screen(self) -> None:
if disallow_full_screen(): if disallow_full_screen():
showWarning( showWarning(
tr.actions_currently_unsupported(), tr.actions_fullscreen_unsupported(),
parent=self, parent=self,
help=HelpPage.FULL_SCREEN_ISSUE, help=HelpPage.FULL_SCREEN_ISSUE,
) )

View file

@ -1074,19 +1074,13 @@ def qtMenuShortcutWorkaround(qmenu: QMenu) -> None:
def disallow_full_screen() -> bool: def disallow_full_screen() -> bool:
"""Test for OpenGl on Windows, which is known to cause issues with full screen mode. """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.
"""
from aqt import mw from aqt import mw
from aqt.profiles import VideoDriver from aqt.profiles import VideoDriver
return is_win and ( return is_win and (
(qtmajor == 5 and mw.pm.video_driver() == VideoDriver.OpenGL) mw.pm.video_driver() == VideoDriver.OpenGL
or ( and not os.environ.get("ANKI_SOFTWAREOPENGL")
qtmajor == 6
and not os.environ.get("ANKI_SOFTWAREOPENGL")
and os.environ.get("QT_OPENGL") != "software"
)
) )