mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-21 15:14:13 +00:00
Use the style override only for macOS
We currently only need it there. This prevents unwanted side effects on other platforms.
This commit is contained in:
@@ -192,7 +192,6 @@ class Tagger(QtWidgets.QApplication):
|
||||
self.__class__.__instance = self
|
||||
setup_config(self, picard_args.config_file)
|
||||
config = get_config()
|
||||
self.setStyle(OverrideStyle())
|
||||
theme.setup(self)
|
||||
|
||||
self._cmdline_files = picard_args.FILE
|
||||
@@ -1051,19 +1050,6 @@ def process_picard_args():
|
||||
return parser.parse_known_args()[0]
|
||||
|
||||
|
||||
class OverrideStyle(QtWidgets.QProxyStyle):
|
||||
"""Override the default style to fix some platform specific issues"""
|
||||
|
||||
def styleHint(self, hint, option, widget, returnData):
|
||||
# This is disabled on macOS, but prevents collapsing tree view items easily with
|
||||
# left arrow key. Enable this consistently on all platforms.
|
||||
# See https://tickets.metabrainz.org/browse/PICARD-2417
|
||||
# and https://bugreports.qt.io/browse/QTBUG-100305
|
||||
if hint == QtWidgets.QStyle.StyleHint.SH_ItemView_ArrowKeysNavigateIntoChildren:
|
||||
return True
|
||||
return super().styleHint(hint, option, widget, returnData)
|
||||
|
||||
|
||||
def main(localedir=None, autoupdate=True):
|
||||
# Some libs (ie. Phonon) require those to be set
|
||||
QtWidgets.QApplication.setApplicationName(PICARD_APP_NAME)
|
||||
|
||||
@@ -27,6 +27,7 @@ from enum import Enum
|
||||
from PyQt5 import (
|
||||
QtCore,
|
||||
QtGui,
|
||||
QtWidgets,
|
||||
)
|
||||
|
||||
from picard import log
|
||||
@@ -91,6 +92,19 @@ dark_syntax_theme = SyntaxTheme(
|
||||
)
|
||||
|
||||
|
||||
class MacOverrideStyle(QtWidgets.QProxyStyle):
|
||||
"""Override the default style to fix some platform specific issues"""
|
||||
|
||||
def styleHint(self, hint, option, widget, returnData):
|
||||
# This is disabled on macOS, but prevents collapsing tree view items easily with
|
||||
# left arrow key. Enable this consistently on all platforms.
|
||||
# See https://tickets.metabrainz.org/browse/PICARD-2417
|
||||
# and https://bugreports.qt.io/browse/QTBUG-100305
|
||||
if hint == QtWidgets.QStyle.StyleHint.SH_ItemView_ArrowKeysNavigateIntoChildren:
|
||||
return True
|
||||
return super().styleHint(hint, option, widget, returnData)
|
||||
|
||||
|
||||
class BaseTheme:
|
||||
def __init__(self):
|
||||
self._dark_theme = False
|
||||
@@ -104,6 +118,8 @@ class BaseTheme:
|
||||
# across all OSes.
|
||||
if not IS_MACOS and not IS_HAIKU and self._loaded_config_theme != UiTheme.SYSTEM:
|
||||
app.setStyle('Fusion')
|
||||
elif IS_MACOS:
|
||||
app.setStyle(MacOverrideStyle(app.style()))
|
||||
|
||||
app.setStyleSheet(
|
||||
'QGroupBox::title { /* PICARD-1206, Qt bug workaround */ }'
|
||||
|
||||
Reference in New Issue
Block a user