Skip to content

Commit 82e189e

Browse files
committed
[themes] Handle non-existent theme name setting in app stylesheet
1 parent 2a148e2 commit 82e189e

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
@@ -124,7 +124,7 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant> &opts )
124124
ss += QLatin1String( "QGroupBox{ font-weight: 600; }" );
125125

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

src/app/qgsoptions.cpp

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

569569
QString theme = mSettings->value( QStringLiteral( "UI/UITheme" ), QStringLiteral( "default" ) ).toString();
570+
if ( !QgsApplication::uiThemes().contains( theme ) )
571+
{
572+
theme = QStringLiteral( "default" );
573+
}
570574
whileBlocking( cmbUITheme )->setCurrentIndex( cmbUITheme->findText( theme, Qt::MatchFixedString ) );
571575

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

0 commit comments

Comments
 (0)