Fix: Check if Windows 10 before calling setDarkWinTitlebar()
Signed-off-by: TheLastRar <TheLastRar@users.noreply.github.com>
This commit is contained in:
parent
87b0d3fe11
commit
fd099166c6
@ -62,6 +62,7 @@
|
|||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include "ui/WinDarkmode.h"
|
#include "ui/WinDarkmode.h"
|
||||||
|
#include <versionhelpers.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ui/setupwizard/SetupWizard.h"
|
#include "ui/setupwizard/SetupWizard.h"
|
||||||
@ -1154,7 +1155,7 @@ void Application::setApplicationTheme(const QString& name, bool initial)
|
|||||||
auto & theme = (*themeIter).second;
|
auto & theme = (*themeIter).second;
|
||||||
theme->apply(initial);
|
theme->apply(initial);
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
if (m_mainWindow) {
|
if (m_mainWindow && IsWindows10OrGreater()) {
|
||||||
if (QString::compare(theme->id(), "dark") == 0) {
|
if (QString::compare(theme->id(), "dark") == 0) {
|
||||||
WinDarkmode::setDarkWinTitlebar(m_mainWindow->winId(), true);
|
WinDarkmode::setDarkWinTitlebar(m_mainWindow->winId(), true);
|
||||||
} else {
|
} else {
|
||||||
@ -1395,11 +1396,14 @@ MainWindow* Application::showMainWindow(bool minimized)
|
|||||||
m_mainWindow->restoreState(QByteArray::fromBase64(APPLICATION->settings()->get("MainWindowState").toByteArray()));
|
m_mainWindow->restoreState(QByteArray::fromBase64(APPLICATION->settings()->get("MainWindowState").toByteArray()));
|
||||||
m_mainWindow->restoreGeometry(QByteArray::fromBase64(APPLICATION->settings()->get("MainWindowGeometry").toByteArray()));
|
m_mainWindow->restoreGeometry(QByteArray::fromBase64(APPLICATION->settings()->get("MainWindowGeometry").toByteArray()));
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
if (IsWindows10OrGreater())
|
||||||
|
{
|
||||||
if (QString::compare(settings()->get("ApplicationTheme").toString(), "dark") == 0) {
|
if (QString::compare(settings()->get("ApplicationTheme").toString(), "dark") == 0) {
|
||||||
WinDarkmode::setDarkWinTitlebar(m_mainWindow->winId(), true);
|
WinDarkmode::setDarkWinTitlebar(m_mainWindow->winId(), true);
|
||||||
} else {
|
} else {
|
||||||
WinDarkmode::setDarkWinTitlebar(m_mainWindow->winId(), false);
|
WinDarkmode::setDarkWinTitlebar(m_mainWindow->winId(), false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if(minimized)
|
if(minimized)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user