Skip to content

Commit 04388f7

Browse files
committed
Merge pull request #2091 from nirvn/fix_tool_button_size
[GUI] Keep dock icons one size smaller than toolbar icons
2 parents 7db5272 + 62c837e commit 04388f7

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/app/qgisappstylesheet.cpp

+14-2
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,21 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant>& opts )
176176
.arg( palette.highlight().color().name() )
177177
.arg( palette.highlightedText().color().name() );
178178

179-
QString iconSize = opts.value( "iconSize" ).toString();
179+
int iconSize = opts.value( "iconSize" ).toInt();
180+
if ( iconSize > 32 )
181+
{
182+
iconSize -= 16;
183+
}
184+
else if ( iconSize == 32 )
185+
{
186+
iconSize = 24;
187+
}
188+
else
189+
{
190+
iconSize = 16;
191+
}
192+
180193
QgsDebugMsg( QString( "iconSize: %1" ).arg( iconSize ) );
181-
if ( iconSize.isEmpty() ) { return; }
182194
ss += QString( "QDockWidget QToolButton { icon-size: %1px; }" ).arg( iconSize );
183195

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

src/ui/qgsbrowserdockwidgetbase.ui

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
<number>6</number>
3434
</property>
3535
<property name="leftMargin">
36-
<number>0</number>
36+
<number>5</number>
3737
</property>
3838
<property name="rightMargin">
39-
<number>0</number>
39+
<number>5</number>
4040
</property>
4141
<item>
4242
<widget class="QToolButton" name="mBtnRefresh">

0 commit comments

Comments
 (0)