Add profile manager setting to force custom qt stylesheets (#2233)

This commit is contained in:
Matthias Metelka 2022-12-04 03:54:39 +01:00 committed by GitHub
parent fdaa65e064
commit 627313666e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -546,6 +546,12 @@ create table if not exists profiles
def set_theme(self, theme: Theme) -> None:
self.meta["theme"] = theme.value
def force_custom_styles(self) -> bool:
return self.meta.get("force_custom_styles", False)
def set_force_custom_styles(self, enabled: bool) -> None:
self.meta["force_custom_styles"] = enabled
def browser_layout(self) -> BrowserLayout:
from aqt.browser.layout import BrowserLayout

View file

@ -231,7 +231,7 @@ class ThemeManager:
buf = splitter_styles(self)
if not is_mac:
if not is_mac or aqt.mw.pm.force_custom_styles():
from aqt.stylesheets import (
button_styles,
checkbox_styles,
@ -266,7 +266,7 @@ class ThemeManager:
def _apply_palette(self, app: QApplication) -> None:
set_macos_dark_mode(self.night_mode)
if is_mac:
if is_mac and not aqt.mw.pm.force_custom_styles():
app.setStyle(QStyleFactory.create(self._default_style)) # type: ignore
self.default_palette.setColor(
QPalette.ColorRole.Window, self.qcolor(colors.CANVAS)