Core: Move the current default theme to top of chooser

It worked for the light theme but not for the case where (caused by
system settings), the dark theme would be the default.

Change-Id: I4a88875262425017849c18f716c818e8a5881c96
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2024-11-01 15:29:16 +01:00
parent ad914c9e62
commit 600d3288a6

View File

@@ -193,7 +193,8 @@ QList<ThemeEntry> ThemeEntry::availableThemes()
qWarning() << "Warning: No themes found in installation: " qWarning() << "Warning: No themes found in installation: "
<< installThemeDir.toUserOutput(); << installThemeDir.toUserOutput();
// move default theme to front // move default theme to front
int defaultIndex = Utils::indexOf(themes, Utils::equal(&ThemeEntry::id, Id(Constants::DEFAULT_THEME))); const int defaultIndex = Utils::indexOf(themes, Utils::equal(&ThemeEntry::id,
Id::fromString(defaultThemeId())));
if (defaultIndex > 0) { // == exists and not at front if (defaultIndex > 0) { // == exists and not at front
ThemeEntry defaultEntry = themes.takeAt(defaultIndex); ThemeEntry defaultEntry = themes.takeAt(defaultIndex);
themes.prepend(defaultEntry); themes.prepend(defaultEntry);