Skip to content

Commit

Permalink
fix icon/row size
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed May 24, 2018
1 parent 1905cca commit 5eddbb6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/app/locator/qgslocatoroptionswidget.cpp
Expand Up @@ -88,6 +88,8 @@ QgsLocatorFiltersModel::QgsLocatorFiltersModel( QgsLocator *locator, QObject *pa
: QAbstractTableModel( parent )
, mLocator( locator )
{
mIconSize = std::floor( std::max( Qgis::UI_SCALE_FACTOR * QgsApplication::fontMetrics().height() * 1.1, 24.0 ) );
mRowSize = std::floor( std::max( Qgis::UI_SCALE_FACTOR * QgsApplication::fontMetrics().height() * 1.1 * 4 / 3, 32.0 ) );
}

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

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

case Qt::SizeHintRole:
return QSize( 32, 32 );
return QSize( mRowSize, mRowSize );

case Qt::TextAlignmentRole:
if ( index.column() == Config )
Expand Down
2 changes: 2 additions & 0 deletions src/app/locator/qgslocatoroptionswidget.h
Expand Up @@ -109,6 +109,8 @@ class QgsLocatorFiltersModel : public QAbstractTableModel
QHash< QgsLocatorFilter *, bool > mEnabledChanges;
QHash< QgsLocatorFilter *, bool > mDefaultChanges;

int mIconSize, mRowSize;

};

#endif // QGSLOCATOROPTIONSWIDGET_H
Expand Down

0 comments on commit 5eddbb6

Please sign in to comment.