mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
fix: disable Qt6.7's dark mode and force Fusion style no matter what (#1512)
This commit is contained in:
parent
685b2ec418
commit
e7c59679ce
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include "gddebug.hh"
|
#include "gddebug.hh"
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
#include <QStyleFactory>
|
||||||
|
|
||||||
#if defined( USE_BREAKPAD )
|
#if defined( USE_BREAKPAD )
|
||||||
#if defined( Q_OS_MAC )
|
#if defined( Q_OS_MAC )
|
||||||
|
@ -351,6 +352,8 @@ int main( int argc, char ** argv )
|
||||||
freopen( "CON", "w", stderr );
|
freopen( "CON", "w", stderr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qputenv( "QT_QPA_PLATFORM", "windows:darkmode=1" );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -368,6 +371,12 @@ int main( int argc, char ** argv )
|
||||||
QHotkeyApplication::setOrganizationDomain( "https://github.com/xiaoyifang/goldendict-ng" );
|
QHotkeyApplication::setOrganizationDomain( "https://github.com/xiaoyifang/goldendict-ng" );
|
||||||
QHotkeyApplication::setWindowIcon( QIcon( ":/icons/programicon.png" ) );
|
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 )
|
#if defined( USE_BREAKPAD )
|
||||||
QString appDirPath = Config::getConfigDir() + "crash";
|
QString appDirPath = Config::getConfigDir() + "crash";
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
MainWindow {
|
MainWindow,
|
||||||
|
QToolBar {
|
||||||
background-color: #cfddf0;
|
background-color: #cfddf0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1305,9 +1305,7 @@ void MainWindow::updateAppearances( QString const & addonStyle,
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
if ( darkMode ) {
|
if ( darkMode ) {
|
||||||
//https://forum.qt.io/topic/101391/windows-10-dark-theme
|
//https://forum.qt.io/topic/101391/windows-10-dark-theme
|
||||||
#ifdef Q_OS_WIN32
|
|
||||||
qApp->setStyle( QStyleFactory::create( "Fusion" ) );
|
|
||||||
#endif
|
|
||||||
QPalette darkPalette;
|
QPalette darkPalette;
|
||||||
QColor darkColor = QColor( 45, 45, 45 );
|
QColor darkColor = QColor( 45, 45, 45 );
|
||||||
QColor disabledColor = QColor( 127, 127, 127 );
|
QColor disabledColor = QColor( 127, 127, 127 );
|
||||||
|
@ -1334,7 +1332,6 @@ void MainWindow::updateAppearances( QString const & addonStyle,
|
||||||
qApp->setPalette( darkPalette );
|
qApp->setPalette( darkPalette );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qApp->setStyle( new QProxyStyle() );
|
|
||||||
qApp->setPalette( QPalette() );
|
qApp->setPalette( QPalette() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue