Refresh custom colors once color scheme is changed

PR #20588.
This commit is contained in:
Vladimir Golovnev
2024-03-23 11:32:07 +03:00
committed by GitHub
parent 25b7972f88
commit ce013f132f
11 changed files with 195 additions and 126 deletions

View File

@@ -114,8 +114,13 @@ QByteArray DefaultThemeSource::readStyleSheet()
QColor DefaultThemeSource::getColor(const QString &colorId, const ColorMode colorMode) const
{
const auto iter = m_colors.constFind(colorId);
Q_ASSERT(iter != m_colors.constEnd());
if (iter == m_colors.constEnd()) [[unlikely]]
return {};
return (colorMode == ColorMode::Light)
? m_colors.value(colorId).light : m_colors.value(colorId).dark;
? iter.value().light : iter.value().dark;
}
Path DefaultThemeSource::getIconPath(const QString &iconId, const ColorMode colorMode) const