mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-21 23:48: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);
|
||||
|
||||
// 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
|
||||
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", QSettings::NativeFormat);
|
||||
if (settings.value("AppsUseLightTheme", 1).toInt() == 0) {
|
||||
QApplication::setStyle(QStyleFactory::create("Fusion"));
|
||||
QApplication::setPalette(QApplication::style()->standardPalette());
|
||||
|
||||
#if QT_VERSION_MAJOR >= 6
|
||||
#if defined Q_OS_OSX
|
||||
const QPalette palette = QApplication::palette();
|
||||
const QColor& color = palette.color(QPalette::Active, QPalette::Base);
|
||||
if (color.lightness() < 127) { // TreeView has dark background
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QMimeData>
|
||||
#include <QPalette>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QProcess>
|
||||
#include <QSettings>
|
||||
|
Loading…
Reference in New Issue
Block a user