From 550b3f32171a0a0bbc1910d258e1ffac5401006a Mon Sep 17 00:00:00 2001 From: Loren Eteval Date: Mon, 23 Dec 2024 19:40:55 +0800 Subject: [PATCH] Fix theme handling for PySide6 >= 6.7.0 on Windows Signed-off-by: Loren Eteval --- Furious/QtFramework/QtGui.py | 10 ++++++++-- Furious/Widget/XrayAssetViewerQListWidget.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Furious/QtFramework/QtGui.py b/Furious/QtFramework/QtGui.py index 2958d77..a5c9191 100644 --- a/Furious/QtFramework/QtGui.py +++ b/Furious/QtFramework/QtGui.py @@ -174,8 +174,14 @@ class AppQAction(QTranslatable, SupportThemeChangedCallback, QAction): if theme == 'Dark': if PLATFORM == 'Windows': - # Windows. Always use black icon - super().setIcon(bootstrapIcon(self.iconFileName)) + # Windows + if versionToValue(PYSIDE6_VERSION) < versionToValue('6.7.0'): + # PySide6 < 6.7.0 has no system theme handling on Windows. + # Always use black icon + super().setIcon(bootstrapIcon(self.iconFileName)) + else: + # PySide6 has system theme handling. + super().setIcon(bootstrapIconWhite(self.iconFileName)) else: if getUbuntuRelease() == '20.04' and self.isTrayAction: # Ubuntu 20.04 system dark theme does not change tray menu color. diff --git a/Furious/Widget/XrayAssetViewerQListWidget.py b/Furious/Widget/XrayAssetViewerQListWidget.py index 2d5db63..239016d 100644 --- a/Furious/Widget/XrayAssetViewerQListWidget.py +++ b/Furious/Widget/XrayAssetViewerQListWidget.py @@ -134,8 +134,14 @@ class XrayAssetViewerQListWidget(SupportThemeChangedCallback, AppQListWidget): else: if theme == 'Dark': if PLATFORM == 'Windows': - # Windows. Always use black icon - item.setIcon(bootstrapIcon('file-earmark.svg')) + # Windows + if versionToValue(PYSIDE6_VERSION) < versionToValue('6.7.0'): + # PySide6 < 6.7.0 has no system theme handling on Windows. + # Always use black icon + item.setIcon(bootstrapIcon('file-earmark.svg')) + else: + # PySide6 has system theme handling. + item.setIcon(bootstrapIconWhite('file-earmark.svg')) else: item.setIcon(bootstrapIconWhite('file-earmark.svg')) else: