mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Followup 0f8e291f, fix logic relating to overrding default application
style and simplify
This commit is contained in:
parent
b705d90345
commit
f0e7c9c271
@ -1221,24 +1221,20 @@ int main( int argc, char *argv[] )
|
||||
|
||||
// Set the application style. If it's not set QT will use the platform style except on Windows
|
||||
// as it looks really ugly so we use QPlastiqueStyle.
|
||||
QString presetStyle = settings.value( QStringLiteral( "qgis/style" ) ).toString();
|
||||
QString desiredStyle = settings.value( QStringLiteral( "qgis/style" ) ).toString();
|
||||
#ifndef Q_OS_MACX
|
||||
QString theme = settings.value( QStringLiteral( "UI/UITheme" ) ).toString();
|
||||
if ( theme != QStringLiteral( "default" ) )
|
||||
const QString theme = settings.value( QStringLiteral( "UI/UITheme" ) ).toString();
|
||||
if ( theme != QLatin1String( "default" ) )
|
||||
{
|
||||
if ( QStyleFactory::keys().contains( QStringLiteral( "fusion" ), Qt::CaseInsensitive ) )
|
||||
{
|
||||
presetStyle = QStringLiteral( "fusion" );
|
||||
desiredStyle = QStringLiteral( "fusion" );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
QString activeStyleName = presetStyle;
|
||||
if ( activeStyleName.isEmpty() ) // not set, using default style
|
||||
{
|
||||
//not set, check default
|
||||
activeStyleName = QApplication::style()->metaObject()->className();
|
||||
}
|
||||
if ( activeStyleName.contains( QStringLiteral( "adwaita" ), Qt::CaseInsensitive ) )
|
||||
const QString activeStyleName = QApplication::style()->metaObject()->className();
|
||||
if ( desiredStyle.contains( QLatin1String( "adwaita" ), Qt::CaseInsensitive )
|
||||
|| ( desiredStyle.isEmpty() && activeStyleName.contains( QLatin1String( "adwaita" ), Qt::CaseInsensitive ) ) )
|
||||
{
|
||||
//never allow Adwaita themes - the Qt variants of these are VERY broken
|
||||
//for apps like QGIS. E.g. oversized controls like spinbox widgets prevent actually showing
|
||||
@ -1248,16 +1244,15 @@ int main( int argc, char *argv[] )
|
||||
//style choices can cause Qt apps to crash...
|
||||
if ( QStyleFactory::keys().contains( QStringLiteral( "fusion" ), Qt::CaseInsensitive ) )
|
||||
{
|
||||
activeStyleName = QStringLiteral( "fusion" );
|
||||
desiredStyle = QStringLiteral( "fusion" );
|
||||
}
|
||||
}
|
||||
if ( activeStyleName != presetStyle )
|
||||
if ( !desiredStyle.isEmpty() )
|
||||
{
|
||||
settings.setValue( QStringLiteral( "qgis/style" ), QApplication::style()->objectName() );
|
||||
}
|
||||
if ( !presetStyle.isEmpty() )
|
||||
{
|
||||
QApplication::setStyle( presetStyle );
|
||||
QApplication::setStyle( desiredStyle );
|
||||
|
||||
if ( activeStyleName != desiredStyle )
|
||||
settings.setValue( QStringLiteral( "qgis/style" ), desiredStyle );
|
||||
}
|
||||
|
||||
// set authentication database directory
|
||||
|
Loading…
x
Reference in New Issue
Block a user