From fd1776f456ab96a3cdf5418d8ad38ad8dcd3aee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Wed, 17 Jul 2024 08:56:19 +0200 Subject: [PATCH] Case-insensitive base-style handling in stylesheets. --- src/moapplication.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/moapplication.cpp b/src/moapplication.cpp index da06a3af..bf6a4074 100644 --- a/src/moapplication.cpp +++ b/src/moapplication.cpp @@ -603,6 +603,8 @@ QString extractBaseStyleFromStyleSheet(QFile& stylesheet, const QString& default // const auto topLines = extractTopStyleSheetComments(stylesheet); + const auto factoryStyles = QStyleFactory::keys(); + QString style = defaultStyle; for (const auto& line : topLines) { @@ -618,14 +620,15 @@ QString extractBaseStyleFromStyleSheet(QFile& stylesheet, const QString& default } const auto tmpStyle = parts[1].trimmed(); - if (QStyleFactory::keys().count(tmpStyle) == 0) { + const auto index = factoryStyles.indexOf(tmpStyle, 0, Qt::CaseInsensitive); + if (index == -1) { log::warn("base style '{}' from style '{}' not found", tmpStyle, stylesheet.fileName(), line); continue; } - log::info("found base style '{}' for style '{}'", tmpStyle, stylesheet.fileName()); - style = tmpStyle; + style = factoryStyles[index]; + log::info("found base style '{}' for style '{}'", style, stylesheet.fileName()); break; }