Skip to content

Commit

Permalink
Case-insensitive base-style handling in stylesheets.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Jul 17, 2024
1 parent 30b8d23 commit fd1776f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/moapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}

Expand Down

0 comments on commit fd1776f

Please sign in to comment.