Dark mode theme only for Windows
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
#include <QFont>
|
||||
#include <QDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
#ifdef QT_STATIC
|
||||
/* Static builds need plugin imports */
|
||||
@@ -154,6 +156,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[])
|
||||
{
|
||||
@@ -168,6 +174,22 @@ main(int argc, char *argv[])
|
||||
QApplication app(argc, argv);
|
||||
QLocale::setDefault(QLocale::C);
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
Q_INIT_RESOURCE(darkstyle);
|
||||
|
||||
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