mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Only add option list widget styling for default theme
(This allows customized styling for non-default themes, fixes white background on white text issue et cie)
This commit is contained in:
parent
ea9b09f2dc
commit
5b0a6bfa80
@ -760,7 +760,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
|
||||
mStyleSheetBuilder = new QgisAppStyleSheet( this );
|
||||
connect( mStyleSheetBuilder, &QgisAppStyleSheet::appStyleSheetChanged,
|
||||
this, &QgisApp::setAppStyleSheet );
|
||||
mStyleSheetBuilder->buildStyleSheet( mStyleSheetBuilder->defaultOptions() );
|
||||
endProfile();
|
||||
|
||||
QWidget *centralWidget = this->centralWidget();
|
||||
@ -3253,6 +3252,7 @@ void QgisApp::setTheme( const QString &themeName )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
mStyleSheetBuilder->buildStyleSheet( mStyleSheetBuilder->defaultOptions() );
|
||||
QgsApplication::setUITheme( theme );
|
||||
|
||||
//QgsDebugMsg("Setting theme to \n" + themeName);
|
||||
|
@ -89,6 +89,7 @@ QMap<QString, QVariant> QgisAppStyleSheet::defaultOptions()
|
||||
|
||||
void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant> &opts )
|
||||
{
|
||||
QgsSettings settings;
|
||||
QString ss;
|
||||
|
||||
// QgisApp-wide font
|
||||
@ -120,24 +121,28 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant> &opts )
|
||||
|
||||
ss += QLatin1String( "QGroupBox{ font-weight: 600; }" );
|
||||
|
||||
//sidebar style
|
||||
QString style = "QListWidget#mOptionsListWidget {"
|
||||
" background-color: rgb(69, 69, 69, 0);"
|
||||
" outline: 0;"
|
||||
"}"
|
||||
"QFrame#mOptionsListFrame {"
|
||||
" background-color: rgb(69, 69, 69, 220);"
|
||||
"}"
|
||||
"QListWidget#mOptionsListWidget::item {"
|
||||
" color: white;"
|
||||
" padding: 3px;"
|
||||
"}"
|
||||
"QListWidget#mOptionsListWidget::item::selected {"
|
||||
" color: black;"
|
||||
" background-color:palette(Window);"
|
||||
" padding-right: 0px;"
|
||||
"}";
|
||||
ss += style;
|
||||
QString themeName = settings.value( QStringLiteral( "UI/UITheme" ), "default" ).toString();
|
||||
if ( themeName == QStringLiteral( "default" ) )
|
||||
{
|
||||
//sidebar style
|
||||
QString style = "QListWidget#mOptionsListWidget {"
|
||||
" background-color: rgb(69, 69, 69, 0);"
|
||||
" outline: 0;"
|
||||
"}"
|
||||
"QFrame#mOptionsListFrame {"
|
||||
" background-color: rgb(69, 69, 69, 220);"
|
||||
"}"
|
||||
"QListWidget#mOptionsListWidget::item {"
|
||||
" color: white;"
|
||||
" padding: 3px;"
|
||||
"}"
|
||||
"QListWidget#mOptionsListWidget::item::selected {"
|
||||
" color: black;"
|
||||
" background-color:palette(Window);"
|
||||
" padding-right: 0px;"
|
||||
"}";
|
||||
ss += style;
|
||||
}
|
||||
|
||||
// Fix selection color on losing focus (Windows)
|
||||
const QPalette palette = qApp->palette();
|
||||
|
Loading…
x
Reference in New Issue
Block a user