Skip to content
Permalink
Browse files
Avoid "Failed to load file "/style.qss"" startup error
  • Loading branch information
nyalldawson committed Jan 21, 2017
1 parent 56fd6e0 commit 374b75696d5f10fa3989410c422eec21167e845b
Showing with 8 additions and 6 deletions.
  1. +8 −6 src/core/qgsapplication.cpp
@@ -533,11 +533,14 @@ void QgsApplication::setUITheme( const QString &themeName )
{
// Loop all style sheets, find matching name, load it.
QHash<QString, QString> themes = QgsApplication::uiThemes();
QString themename = themeName;
if ( !themes.contains( themename ) )
themename = QStringLiteral( "default" );
if ( themeName == QStringLiteral( "default" ) || !themes.contains( themeName ) )
{
setThemeName( QStringLiteral( "default" ) );
qApp->setStyleSheet( QString() );
return;
}

QString path = themes[themename];
QString path = themes.value( themeName );
QString stylesheetname = path + "/style.qss";
QString autostylesheet = stylesheetname + ".auto";

@@ -554,7 +557,6 @@ void QgsApplication::setUITheme( const QString &themeName )
return;
}

QHash<QString, QString> variables;
QString styledata = file.readAll();
QTextStream in( &variablesfile );
while ( !in.atEnd() )
@@ -580,7 +582,7 @@ void QgsApplication::setUITheme( const QString &themeName )
QString styleSheet = QStringLiteral( "file:///" );
styleSheet.append( stylesheetname );
qApp->setStyleSheet( styleSheet );
setThemeName( themename );
setThemeName( themeName );
}

QHash<QString, QString> QgsApplication::uiThemes()

0 comments on commit 374b756

Please sign in to comment.