Fixing style check for Qt5

This commit is contained in:
Hydrus Network Developer 2024-03-27 19:59:26 -05:00
parent 7575cc9f13
commit 47c79b2177
No known key found for this signature in database
GPG Key ID: 76249F053212133C
1 changed files with 18 additions and 3 deletions

View File

@ -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