diff --git a/src/qt6ct-common/qt6ct.cpp b/src/qt6ct-common/qt6ct.cpp index 6cd5b2c..220738e 100644 --- a/src/qt6ct-common/qt6ct.cpp +++ b/src/qt6ct-common/qt6ct.cpp @@ -124,6 +124,9 @@ QStringList Qt6CT::sharedColorSchemePaths() QString Qt6CT::resolvePath(const QString &path) { + if(path.isEmpty()) + return path; + QString tmp = path; tmp.replace("~", QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); if(!tmp.contains("$")) diff --git a/src/qt6ct-qtplugin/qt6ctplatformtheme.cpp b/src/qt6ct-qtplugin/qt6ctplatformtheme.cpp index dca9423..d724d67 100644 --- a/src/qt6ct-qtplugin/qt6ctplatformtheme.cpp +++ b/src/qt6ct-qtplugin/qt6ctplatformtheme.cpp @@ -250,18 +250,16 @@ void Qt6CTPlatformTheme::updateSettings() void Qt6CTPlatformTheme::readSettings() { - m_palette.reset(); - QSettings settings(Qt6CT::configFile(), QSettings::IniFormat); settings.beginGroup("Appearance"); m_style = settings.value("style", "Fusion").toString(); - QString schemePath = settings.value("color_scheme_path").toString(); - if(!schemePath.isEmpty() && settings.value("custom_palette", false).toBool()) - { - schemePath = Qt6CT::resolvePath(schemePath); //replace environment variables - m_palette = std::make_unique(Qt6CT::loadColorScheme(schemePath, *QPlatformTheme::palette(SystemPalette))); - } + QString schemePath = settings.value("custom_palette", false).toBool() + ? Qt6CT::resolvePath(settings.value("color_scheme_path").toString()) //replace environment variables + : QString(); + m_palette = !schemePath.isEmpty() + ? std::make_unique(Qt6CT::loadColorScheme(schemePath, *QPlatformTheme::palette(SystemPalette))) + : nullptr; m_iconTheme = settings.value("icon_theme").toString(); //load dialogs if(!m_update) diff --git a/src/qt6ct/appearancepage.cpp b/src/qt6ct/appearancepage.cpp index 312f188..b599c06 100644 --- a/src/qt6ct/appearancepage.cpp +++ b/src/qt6ct/appearancepage.cpp @@ -326,8 +326,7 @@ void AppearancePage::readSettings() m_ui->styleComboBox->setCurrentText(style); m_ui->customPaletteButton->setChecked(settings.value("custom_palette", false).toBool()); - QString colorSchemePath = settings.value("color_scheme_path").toString(); - colorSchemePath = Qt6CT::resolvePath(colorSchemePath); //replace environment variables + QString colorSchemePath = Qt6CT::resolvePath(settings.value("color_scheme_path").toString()); //replace environment variables QDir("/").mkpath(Qt6CT::userColorSchemePath()); findColorSchemes(Qt6CT::userColorSchemePath());