| 1160 | } |
| 1161 | |
| 1162 | void Application::setApplicationTheme(const QString& name, bool initial) |
| 1163 | { |
| 1164 | auto systemPalette = qApp->palette(); |
| 1165 | auto themeIter = m_themes.find(name); |
| 1166 | if(themeIter != m_themes.end()) |
| 1167 | { |
| 1168 | auto & theme = (*themeIter).second; |
| 1169 | theme->apply(initial); |
| 1170 | #ifdef Q_OS_WIN |
| 1171 | if (m_mainWindow) { |
| 1172 | if (QString::compare(theme->id(), "dark") == 0) { |
| 1173 | WinDarkmode::setWindowDarkModeEnabled((HWND)m_mainWindow->winId(), true); |
| 1174 | } else { |
| 1175 | WinDarkmode::setWindowDarkModeEnabled((HWND)m_mainWindow->winId(), false); |
| 1176 | } |
| 1177 | } |
| 1178 | #endif |
| 1179 | } |
| 1180 | else |
| 1181 | { |
| 1182 | qWarning() << "Tried to set invalid theme:" << name; |
| 1183 | } |
| 1184 | } |
| 1185 | |
| 1186 | void Application::setIconTheme(const QString& name) |
| 1187 | { |
no test coverage detected