Skip to content

Commit

Permalink
Merge pull request #2071 from nirvn/fix_dock_tool_button
Browse files Browse the repository at this point in the history
[gui] apply icon size user preference to dock widget tool buttons
  • Loading branch information
NathanW2 committed May 27, 2015
2 parents 26e6725 + a0a1cea commit 4edc4b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/qgisappstylesheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "qgisappstylesheet.h"
#include "qgsapplication.h"
#include "qgisapp.h"
#include "qgslogger.h"

#include <QFont>
Expand Down Expand Up @@ -91,6 +92,8 @@ QMap<QString, QVariant> QgisAppStyleSheet::defaultOptions()

settings.endGroup(); // "qgis/stylesheet"

opts.insert( "iconSize", settings.value( "/IconSize", QGIS_ICON_SIZE ) );

return opts;
}

Expand Down Expand Up @@ -173,6 +176,11 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant>& opts )
.arg( palette.highlight().color().name() )
.arg( palette.highlightedText().color().name() );

QString iconSize = opts.value( "iconSize" ).toString();
QgsDebugMsg( QString( "iconSize: %1" ).arg( iconSize ) );
if ( iconSize.isEmpty() ) { return; }
ss += QString( "QDockWidget QToolButton { icon-size: %1px; }" ).arg( iconSize );

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

emit appStyleSheetChanged( ss );
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgsoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,9 @@ void QgsOptions::on_pbnTemplateFolderReset_pressed()
void QgsOptions::iconSizeChanged( const QString &iconSize )
{
QgisApp::instance()->setIconSizes( iconSize.toInt() );

mStyleSheetNewOpts.insert( "iconSize", QVariant( iconSize.toInt() ) );
mStyleSheetBuilder->buildStyleSheet( mStyleSheetNewOpts );
}

void QgsOptions::on_mProjectOnLaunchCmbBx_currentIndexChanged( int indx )
Expand Down

0 comments on commit 4edc4b9

Please sign in to comment.