Skip to content
Permalink
Browse files
Use a regular grid for style manager icon views
Because the irregular grid just looks gross
  • Loading branch information
nyalldawson committed Oct 14, 2021
1 parent 0200327 commit 2d703b6d661025e343592b05db1369efa4d3556f
Showing with 11 additions and 0 deletions.
  1. +5 −0 src/gui/qgsstyleitemslistwidget.cpp
  2. +3 −0 src/gui/symbology/qgsstyleexportimportdialog.cpp
  3. +3 −0 src/gui/symbology/qgsstylemanagerdialog.cpp
@@ -137,6 +137,11 @@ void QgsStyleItemsListWidget::setStyle( QgsStyle *style )

mModel->addDesiredIconSize( viewSymbols->iconSize() );
mModel->addDesiredIconSize( mSymbolTreeView->iconSize() );

// set a grid size which allows sufficient vertical spacing to fit reasonably sized entity names
viewSymbols->setGridSize( QSize( static_cast< int >( viewSymbols->iconSize().width() * 1.4 ), static_cast< int >( viewSymbols->iconSize().height() * 1.7 ) ) );
viewSymbols->setTextElideMode( Qt::TextElideMode::ElideRight );

viewSymbols->setModel( mModel );
mSymbolTreeView->setModel( mModel );

@@ -121,6 +121,9 @@ QgsStyleExportImportDialog::QgsStyleExportImportDialog( QgsStyle *style, QWidget

const double iconSize = Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance( 'X' ) * 10;
listItems->setIconSize( QSize( static_cast< int >( iconSize ), static_cast< int >( iconSize * 0.9 ) ) ); // ~100, 90 on low dpi
// set a grid size which allows sufficient vertical spacing to fit reasonably sized entity names
listItems->setGridSize( QSize( static_cast< int >( listItems->iconSize().width() * 1.4 ), static_cast< int >( listItems->iconSize().height() * 1.7 ) ) );
listItems->setTextElideMode( Qt::TextElideMode::ElideRight );

mModel = new QgsStyleProxyModel( dialogStyle, this );

@@ -280,6 +280,9 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle *style, QWidget *parent,

double iconSize = Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance( 'X' ) * 10;
listItems->setIconSize( QSize( static_cast< int >( iconSize ), static_cast< int >( iconSize * 0.9 ) ) ); // ~100, 90 on low dpi
// set a grid size which allows sufficient vertical spacing to fit reasonably sized entity names
listItems->setGridSize( QSize( static_cast< int >( listItems->iconSize().width() * 1.4 ), static_cast< int >( listItems->iconSize().height() * 1.7 ) ) );
listItems->setTextElideMode( Qt::TextElideMode::ElideRight );
double treeIconSize = Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance( 'X' ) * 2;
mSymbolTreeView->setIconSize( QSize( static_cast< int >( treeIconSize ), static_cast< int >( treeIconSize ) ) );

0 comments on commit 2d703b6

Please sign in to comment.