Skip to content

Commit 5eddbb6

Browse files
committed
fix icon/row size
1 parent 1905cca commit 5eddbb6

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/app/locator/qgslocatoroptionswidget.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ QgsLocatorFiltersModel::QgsLocatorFiltersModel( QgsLocator *locator, QObject *pa
8888
: QAbstractTableModel( parent )
8989
, mLocator( locator )
9090
{
91+
mIconSize = std::floor( std::max( Qgis::UI_SCALE_FACTOR * QgsApplication::fontMetrics().height() * 1.1, 24.0 ) );
92+
mRowSize = std::floor( std::max( Qgis::UI_SCALE_FACTOR * QgsApplication::fontMetrics().height() * 1.1 * 4 / 3, 32.0 ) );
9193
}
9294

9395
QWidget *QgsLocatorFiltersModel::configButton( const QModelIndex &index, QWidget *parent ) const
@@ -107,8 +109,7 @@ QWidget *QgsLocatorFiltersModel::configButton( const QModelIndex &index, QWidget
107109
w->setLayout( layout );
108110

109111
connect( bt, &QToolButton::clicked, this, [ = ]() {filter->openConfigWidget( bt );} );
110-
//bt->setMinimumSize( 24, 24 );
111-
bt->setMaximumSize( 24, 24 );
112+
bt->setMaximumSize( mIconSize, mIconSize );
112113
bt->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
113114
bt->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/propertyicons/settings.svg" ) ) );
114115
return w;
@@ -191,7 +192,7 @@ QVariant QgsLocatorFiltersModel::data( const QModelIndex &index, int role ) cons
191192
break;
192193

193194
case Qt::SizeHintRole:
194-
return QSize( 32, 32 );
195+
return QSize( mRowSize, mRowSize );
195196

196197
case Qt::TextAlignmentRole:
197198
if ( index.column() == Config )

src/app/locator/qgslocatoroptionswidget.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ class QgsLocatorFiltersModel : public QAbstractTableModel
109109
QHash< QgsLocatorFilter *, bool > mEnabledChanges;
110110
QHash< QgsLocatorFilter *, bool > mDefaultChanges;
111111

112+
int mIconSize, mRowSize;
113+
112114
};
113115

114116
#endif // QGSLOCATOROPTIONSWIDGET_H

0 commit comments

Comments
 (0)