Skip to content

Commit 8eb1c4e

Browse files
committed
[themes] Handle non-existent theme name setting in app stylesheet
1 parent f3cb348 commit 8eb1c4e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/app/qgisappstylesheet.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant> &opts )
122122
ss += QLatin1String( "QGroupBox{ font-weight: 600; }" );
123123

124124
QString themeName = settings.value( QStringLiteral( "UI/UITheme" ), "default" ).toString();
125-
if ( themeName == QStringLiteral( "default" ) )
125+
if ( themeName == QStringLiteral( "default" ) || !QgsApplication::uiThemes().contains( themeName ) )
126126
{
127127
//sidebar style
128128
QString style = "QListWidget#mOptionsListWidget {"

src/app/qgsoptions.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,10 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
572572
whileBlocking( cmbStyle )->setCurrentIndex( cmbStyle->findText( name, Qt::MatchFixedString ) );
573573

574574
QString theme = mSettings->value( QStringLiteral( "UI/UITheme" ), QStringLiteral( "default" ) ).toString();
575+
if ( !QgsApplication::uiThemes().contains( theme ) )
576+
{
577+
theme = QStringLiteral( "default" );
578+
}
575579
whileBlocking( cmbUITheme )->setCurrentIndex( cmbUITheme->findText( theme, Qt::MatchFixedString ) );
576580

577581
mNativeColorDialogsChkBx->setChecked( mSettings->value( QStringLiteral( "/qgis/native_color_dialogs" ), false ).toBool() );

0 commit comments

Comments
 (0)