mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 07:58:22 +08:00
Detect macOS dark aqua mode
This commit is contained in:
parent
745f4b69f2
commit
6232836fb6
@ -168,14 +168,23 @@ void UEFITool::init()
|
|||||||
ui->builderMessagesListWidget->installEventFilter(this);
|
ui->builderMessagesListWidget->installEventFilter(this);
|
||||||
|
|
||||||
// Switch default window style to Fusion on Qt6 Windows builds
|
// Switch default window style to Fusion on Qt6 Windows builds
|
||||||
// TODO: remove this once default style gains dark theme support
|
|
||||||
#if defined Q_OS_WIN and QT_VERSION_MAJOR >= 6
|
#if QT_VERSION_MAJOR >= 6
|
||||||
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", QSettings::NativeFormat);
|
#if defined Q_OS_OSX
|
||||||
if (settings.value("AppsUseLightTheme", 1).toInt() == 0) {
|
const QPalette palette = QApplication::palette();
|
||||||
QApplication::setStyle(QStyleFactory::create("Fusion"));
|
const QColor& color = palette.color(QPalette::Active, QPalette::Base);
|
||||||
QApplication::setPalette(QApplication::style()->standardPalette());
|
if (color.lightness() < 127) { // TreeView has dark background
|
||||||
model->setMarkingDarkMode(true);
|
model->setMarkingDarkMode(true);
|
||||||
}
|
}
|
||||||
|
#elif defined Q_OS_WIN
|
||||||
|
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", QSettings::NativeFormat);
|
||||||
|
if (settings.value("AppsUseLightTheme", 1).toInt() == 0) {
|
||||||
|
model->setMarkingDarkMode(true);
|
||||||
|
// TODO: remove this once default style gains dark theme support
|
||||||
|
QApplication::setStyle(QStyleFactory::create("Fusion"));
|
||||||
|
QApplication::setPalette(QApplication::style()->standardPalette());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
#include <QPalette>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
Loading…
Reference in New Issue
Block a user