GH-1790 do not apply system theme on launch if it is selected
This prevents some ugly colors to show up on macOS in most cases. It still looks ugly right after you switch to the it though.
This commit is contained in:
parent
201d4ac317
commit
ceb5fc6d75
7 changed files with 44 additions and 29 deletions
|
@ -355,7 +355,7 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
|
|||
connect(this, SIGNAL(aboutToQuit()), SLOT(onExit()));
|
||||
|
||||
setIconTheme(settings()->get("IconTheme").toString());
|
||||
setApplicationTheme(settings()->get("ApplicationTheme").toString());
|
||||
setApplicationTheme(settings()->get("ApplicationTheme").toString(), true);
|
||||
|
||||
initAnalytics();
|
||||
|
||||
|
@ -868,27 +868,14 @@ void MultiMC::initThemes()
|
|||
insertTheme(new CustomTheme(darkTheme, "custom"));
|
||||
}
|
||||
|
||||
void MultiMC::setApplicationTheme(const QString& name)
|
||||
void MultiMC::setApplicationTheme(const QString& name, bool initial)
|
||||
{
|
||||
auto systemPalette = qApp->palette();
|
||||
auto themeIter = m_themes.find(name);
|
||||
if(themeIter != m_themes.end())
|
||||
{
|
||||
auto & theme = (*themeIter).second;
|
||||
setStyle(QStyleFactory::create(theme->qtTheme()));
|
||||
if(theme->hasColorScheme())
|
||||
{
|
||||
setPalette(theme->colorScheme());
|
||||
}
|
||||
if(theme->hasStyleSheet())
|
||||
{
|
||||
setStyleSheet(theme->appStyleSheet());
|
||||
}
|
||||
else
|
||||
{
|
||||
setStyleSheet(QString());
|
||||
}
|
||||
QDir::setSearchPaths("theme", theme->searchPaths());
|
||||
theme->apply(initial);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue