Skip to content

Commit fd1776f

Browse files
committed
Case-insensitive base-style handling in stylesheets.
1 parent 30b8d23 commit fd1776f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/moapplication.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,8 @@ QString extractBaseStyleFromStyleSheet(QFile& stylesheet, const QString& default
603603
//
604604
const auto topLines = extractTopStyleSheetComments(stylesheet);
605605

606+
const auto factoryStyles = QStyleFactory::keys();
607+
606608
QString style = defaultStyle;
607609

608610
for (const auto& line : topLines) {
@@ -618,14 +620,15 @@ QString extractBaseStyleFromStyleSheet(QFile& stylesheet, const QString& default
618620
}
619621

620622
const auto tmpStyle = parts[1].trimmed();
621-
if (QStyleFactory::keys().count(tmpStyle) == 0) {
623+
const auto index = factoryStyles.indexOf(tmpStyle, 0, Qt::CaseInsensitive);
624+
if (index == -1) {
622625
log::warn("base style '{}' from style '{}' not found", tmpStyle,
623626
stylesheet.fileName(), line);
624627
continue;
625628
}
626629

627-
log::info("found base style '{}' for style '{}'", tmpStyle, stylesheet.fileName());
628-
style = tmpStyle;
630+
style = factoryStyles[index];
631+
log::info("found base style '{}' for style '{}'", style, stylesheet.fileName());
629632
break;
630633
}
631634

0 commit comments

Comments
 (0)