Allow to use Qt's default QStyle

Relevant prior PR #21553

PR #21605.
This commit is contained in:
sledgehammer999 2024-10-21 19:59:55 +03:00 committed by GitHub
parent 3ab9fe55e5
commit a3ac692c25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 26 additions and 20 deletions

View file

@ -37,10 +37,6 @@
#include <QStyle>
#include <QStyleHints>
#ifdef Q_OS_WIN
#include <QOperatingSystemVersion>
#endif
#include "base/global.h"
#include "base/logger.h"
#include "base/path.h"
@ -88,9 +84,11 @@ UIThemeManager::UIThemeManager()
#endif
{
#ifdef Q_OS_WIN
const QString defaultStyle = (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows10) ? u"Fusion"_s : QString();
if (const QString styleName = Preferences::instance()->getStyle(); !QApplication::setStyle(styleName.isEmpty() ? defaultStyle : styleName))
LogMsg(tr("Set app style failed. Unknown style: \"%1\"").arg(styleName), Log::WARNING);
if (const QString styleName = Preferences::instance()->getStyle(); styleName.compare(u"system", Qt::CaseInsensitive) != 0)
{
if (!QApplication::setStyle(styleName.isEmpty() ? u"Fusion"_s : styleName))
LogMsg(tr("Set app style failed. Unknown style: \"%1\"").arg(styleName), Log::WARNING);
}
#endif
#ifdef QBT_HAS_COLORSCHEME_OPTION