MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / setApplicationTheme

Method setApplicationTheme

launcher/Application.cpp:1162–1184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1160}
1161
1162void 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
1186void Application::setIconTheme(const QString& name)
1187{

Callers 1

applySettingsMethod · 0.80

Calls 5

setWindowDarkModeEnabledFunction · 0.85
endMethod · 0.80
findMethod · 0.45
applyMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected