From 47c79b2177e4eeb4ec69eda862c49114f42ec39a Mon Sep 17 00:00:00 2001 From: Hydrus Network Developer Date: Wed, 27 Mar 2024 19:59:26 -0500 Subject: [PATCH] Fixing style check for Qt5 --- hydrus/client/gui/ClientGUIStyle.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/hydrus/client/gui/ClientGUIStyle.py b/hydrus/client/gui/ClientGUIStyle.py index 509c2072..695e94f1 100644 --- a/hydrus/client/gui/ClientGUIStyle.py +++ b/hydrus/client/gui/ClientGUIStyle.py @@ -5,7 +5,8 @@ from qtpy import QtWidgets as QW from hydrus.core import HydrusConstants as HC from hydrus.core import HydrusData from hydrus.core import HydrusExceptions -from hydrus.core import HydrusTime + +from hydrus.client.gui import QtInit STYLESHEET_DIR = os.path.join( HC.STATIC_DIR, 'qss' ) @@ -67,7 +68,14 @@ def InitialiseDefaults(): global ORIGINAL_STYLE_NAME - ORIGINAL_STYLE_NAME = QW.QApplication.instance().style().name() + if QtInit.WE_ARE_QT5: + + ORIGINAL_STYLE_NAME = QW.QApplication.instance().style().objectName() + + else: + + ORIGINAL_STYLE_NAME = QW.QApplication.instance().style().name() + global ORIGINAL_STYLESHEET global CURRENT_STYLESHEET @@ -77,8 +85,15 @@ def InitialiseDefaults(): def SetStyleFromName( name: str ): - current_style_name = QW.QApplication.instance().style().name() + if QtInit.WE_ARE_QT5: + current_style_name = QW.QApplication.instance().style().objectName() + + else: + + current_style_name = QW.QApplication.instance().style().name() + + if name.casefold() == current_style_name.casefold(): return