From 20fa8fe64b1885ea63fa09441f1f8b18939d804b Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Tue, 5 Jul 2022 18:34:45 +0200 Subject: [PATCH] PICARD-2515: Ensure color chooser buttons can be styled on macOS On macOS the style override prevents styling these buttons. Hence explicitly reset the style for these widgets only. --- picard/ui/options/interface_colors.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/picard/ui/options/interface_colors.py b/picard/ui/options/interface_colors.py index 23399e816..5b8c4f805 100644 --- a/picard/ui/options/interface_colors.py +++ b/picard/ui/options/interface_colors.py @@ -29,6 +29,7 @@ from PyQt5 import ( ) from picard.config import Option +from picard.const.sys import IS_MACOS from picard.ui.colors import ( InterfaceColors, @@ -47,7 +48,10 @@ class ColorButton(QtWidgets.QPushButton): def __init__(self, initial_color=None, parent=None): super().__init__(' ', parent=parent) - + # On macOS the style override in picard.ui.theme breaks styling these + # buttons. Explicitly reset the style for this widget only. + if IS_MACOS: + self.setStyle(QtWidgets.QStyleFactory.create('macintosh')) color = QtGui.QColor(initial_color) if not color.isValid(): color = QtGui.QColor("black")