diff --git a/src/main.cc b/src/main.cc index c909b7af..5b64efe0 100644 --- a/src/main.cc +++ b/src/main.cc @@ -31,6 +31,7 @@ #include "gddebug.hh" #include +#include #if defined( USE_BREAKPAD ) #if defined( Q_OS_MAC ) @@ -351,6 +352,8 @@ int main( int argc, char ** argv ) freopen( "CON", "w", stderr ); } + qputenv( "QT_QPA_PLATFORM", "windows:darkmode=1" ); + #endif @@ -368,6 +371,12 @@ int main( int argc, char ** argv ) QHotkeyApplication::setOrganizationDomain( "https://github.com/xiaoyifang/goldendict-ng" ); QHotkeyApplication::setWindowIcon( QIcon( ":/icons/programicon.png" ) ); +#ifdef Q_OS_WIN + // TODO: Force fusion because Qt6.7's "ModernStyle"'s dark theme have problems, need to test / reconsider in future + QHotkeyApplication::setStyle( QStyleFactory::create( "Fusion" ) ); +#endif + + #if defined( USE_BREAKPAD ) QString appDirPath = Config::getConfigDir() + "crash"; diff --git a/src/stylesheets/qt-lingoes-blue.css b/src/stylesheets/qt-lingoes-blue.css index 39a2e2c8..9266e208 100644 --- a/src/stylesheets/qt-lingoes-blue.css +++ b/src/stylesheets/qt-lingoes-blue.css @@ -1,4 +1,5 @@ -MainWindow { +MainWindow, +QToolBar { background-color: #cfddf0; } diff --git a/src/ui/mainwindow.cc b/src/ui/mainwindow.cc index c77092f0..a430dca9 100644 --- a/src/ui/mainwindow.cc +++ b/src/ui/mainwindow.cc @@ -1305,9 +1305,7 @@ void MainWindow::updateAppearances( QString const & addonStyle, #ifdef Q_OS_WIN32 if ( darkMode ) { //https://forum.qt.io/topic/101391/windows-10-dark-theme - #ifdef Q_OS_WIN32 - qApp->setStyle( QStyleFactory::create( "Fusion" ) ); - #endif + QPalette darkPalette; QColor darkColor = QColor( 45, 45, 45 ); QColor disabledColor = QColor( 127, 127, 127 ); @@ -1334,7 +1332,6 @@ void MainWindow::updateAppearances( QString const & addonStyle, qApp->setPalette( darkPalette ); } else { - qApp->setStyle( new QProxyStyle() ); qApp->setPalette( QPalette() ); } #endif