Merge pull request #5200 from Cacodemon345/windows-dark-mode
Windows dark mode
This commit is contained in:
@@ -342,6 +342,10 @@ main_thread_fn()
|
||||
|
||||
static std::thread *main_thread;
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
extern bool windows_is_light_theme();
|
||||
#endif
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
@@ -357,6 +361,23 @@ main(int argc, char *argv[])
|
||||
QApplication app(argc, argv);
|
||||
QLocale::setDefault(QLocale::C);
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
Q_INIT_RESOURCE(darkstyle);
|
||||
QApplication::setAttribute(Qt::AA_NativeWindows);
|
||||
|
||||
if (!windows_is_light_theme()) {
|
||||
QFile f(":qdarkstyle/dark/darkstyle.qss");
|
||||
|
||||
if (!f.exists()) {
|
||||
printf("Unable to set stylesheet, file not found\n");
|
||||
} else {
|
||||
f.open(QFile::ReadOnly | QFile::Text);
|
||||
QTextStream ts(&f);
|
||||
qApp->setStyleSheet(ts.readAll());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
qt_set_sequence_auto_mnemonic(false);
|
||||
Q_INIT_RESOURCE(qt_resources);
|
||||
Q_INIT_RESOURCE(qt_translations);
|
||||
|
||||
Reference in New Issue
Block a user