@@ -533,11 +533,14 @@ void QgsApplication::setUITheme( const QString &themeName )
533
533
{
534
534
// Loop all style sheets, find matching name, load it.
535
535
QHash<QString, QString> themes = QgsApplication::uiThemes ();
536
- QString themename = themeName;
537
- if ( !themes.contains ( themename ) )
538
- themename = QStringLiteral ( " default" );
536
+ if ( themeName == QStringLiteral ( " default" ) || !themes.contains ( themeName ) )
537
+ {
538
+ setThemeName ( QStringLiteral ( " default" ) );
539
+ qApp->setStyleSheet ( QString () );
540
+ return ;
541
+ }
539
542
540
- QString path = themes[themename] ;
543
+ QString path = themes. value ( themeName ) ;
541
544
QString stylesheetname = path + " /style.qss" ;
542
545
QString autostylesheet = stylesheetname + " .auto" ;
543
546
@@ -554,7 +557,6 @@ void QgsApplication::setUITheme( const QString &themeName )
554
557
return ;
555
558
}
556
559
557
- QHash<QString, QString> variables;
558
560
QString styledata = file.readAll ();
559
561
QTextStream in ( &variablesfile );
560
562
while ( !in.atEnd () )
@@ -580,7 +582,7 @@ void QgsApplication::setUITheme( const QString &themeName )
580
582
QString styleSheet = QStringLiteral ( " file:///" );
581
583
styleSheet.append ( stylesheetname );
582
584
qApp->setStyleSheet ( styleSheet );
583
- setThemeName ( themename );
585
+ setThemeName ( themeName );
584
586
}
585
587
586
588
QHash<QString, QString> QgsApplication::uiThemes ()
0 commit comments