From fd099166c6a69bf77491cef8aa42cbdf06c78e35 Mon Sep 17 00:00:00 2001 From: TheLastRar Date: Sun, 30 Oct 2022 20:27:37 +0000 Subject: [PATCH] Fix: Check if Windows 10 before calling setDarkWinTitlebar() Signed-off-by: TheLastRar --- launcher/Application.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index c6814abf..38613280 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -62,6 +62,7 @@ #ifdef Q_OS_WIN #include "ui/WinDarkmode.h" +#include #endif #include "ui/setupwizard/SetupWizard.h" @@ -1154,7 +1155,7 @@ void Application::setApplicationTheme(const QString& name, bool initial) auto & theme = (*themeIter).second; theme->apply(initial); #ifdef Q_OS_WIN - if (m_mainWindow) { + if (m_mainWindow && IsWindows10OrGreater()) { if (QString::compare(theme->id(), "dark") == 0) { WinDarkmode::setDarkWinTitlebar(m_mainWindow->winId(), true); } else { @@ -1395,10 +1396,13 @@ MainWindow* Application::showMainWindow(bool minimized) m_mainWindow->restoreState(QByteArray::fromBase64(APPLICATION->settings()->get("MainWindowState").toByteArray())); m_mainWindow->restoreGeometry(QByteArray::fromBase64(APPLICATION->settings()->get("MainWindowGeometry").toByteArray())); #ifdef Q_OS_WIN - if (QString::compare(settings()->get("ApplicationTheme").toString(), "dark") == 0) { - WinDarkmode::setDarkWinTitlebar(m_mainWindow->winId(), true); - } else { - WinDarkmode::setDarkWinTitlebar(m_mainWindow->winId(), false); + if (IsWindows10OrGreater()) + { + if (QString::compare(settings()->get("ApplicationTheme").toString(), "dark") == 0) { + WinDarkmode::setDarkWinTitlebar(m_mainWindow->winId(), true); + } else { + WinDarkmode::setDarkWinTitlebar(m_mainWindow->winId(), false); + } } #endif if(minimized)