mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Add hidden configuration setting to set toolbar padding
Can be tweaked for better appearance on hidpi screens, e.g. on my display a padding of 8 px looks best
This commit is contained in:
parent
a0b4e024bb
commit
0be9de5dfc
@ -28,6 +28,11 @@ connections-xyz\OpenStreetMap\username=
|
||||
connections-xyz\OpenStreetMap\zmax=19
|
||||
connections-xyz\OpenStreetMap\zmin=0
|
||||
|
||||
# application stylesheet
|
||||
|
||||
# Padding (in pixels) to add to toolbar icons, if blank then default padding will be used
|
||||
stylesheet\toolbarSpacing=
|
||||
|
||||
[app]
|
||||
|
||||
# Maximum number of recent projects to show on the welcome page
|
||||
|
@ -82,6 +82,8 @@ QMap<QString, QVariant> QgisAppStyleSheet::defaultOptions()
|
||||
bool gbxCustom = ( mMacStyle );
|
||||
opts.insert( QStringLiteral( "groupBoxCustom" ), settings.value( QStringLiteral( "groupBoxCustom" ), QVariant( gbxCustom ) ) );
|
||||
|
||||
opts.insert( QStringLiteral( "toolbarSpacing" ), settings.value( QStringLiteral( "toolbarSpacing" ), QString() ) );
|
||||
|
||||
settings.endGroup(); // "qgis/stylesheet"
|
||||
|
||||
opts.insert( QStringLiteral( "iconSize" ), settings.value( QStringLiteral( "/qgis/iconSize" ), QGIS_ICON_SIZE ) );
|
||||
@ -185,6 +187,17 @@ 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( QString( "Stylesheet built: %1" ).arg( ss ) );
|
||||
|
||||
emit appStyleSheetChanged( ss );
|
||||
|
Loading…
x
Reference in New Issue
Block a user