Skip to content

Commit

Permalink
Only apply custom toolbar spacing for default theme
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jan 1, 2019
1 parent aa7d4a7 commit 540f952
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/app/qgisappstylesheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant> &opts )
" background-color:palette(Window);"
" padding-right: 0px;"
"}";

QString toolbarSpacing = opts.value( QStringLiteral( "toolbarSpacing" ), QString() ).toString();
if ( !toolbarSpacing.isEmpty() )
{
bool ok = false;
int toolbarSpacingInt = toolbarSpacing.toInt( &ok );
if ( ok )
{
style += QStringLiteral( "QToolBar > QToolButton { padding: %1px; } " ).arg( toolbarSpacingInt );
}
}

ss += style;
}

Expand All @@ -156,17 +168,6 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant> &opts )
.arg( palette.highlight().color().name(),
palette.highlightedText().color().name() );

QString toolbarSpacing = opts.value( QStringLiteral( "toolbarSpacing" ), QString() ).toString();
if ( !toolbarSpacing.isEmpty() )
{
bool ok = false;
int toolbarSpacingInt = toolbarSpacing.toInt( &ok );
if ( ok )
{
ss += QStringLiteral( "QToolBar > QToolButton { padding: %1px; } " ).arg( toolbarSpacingInt );
}
}

QgsDebugMsg( QStringLiteral( "Stylesheet built: %1" ).arg( ss ) );

emit appStyleSheetChanged( ss );
Expand Down

0 comments on commit 540f952

Please sign in to comment.