Skip to content

Commit

Permalink
Fix slightly oversized filter clear icons
Browse files Browse the repository at this point in the history
And make sure on low-dpi screens the icon size is 16px for
pixel-snapped rendering of the svg
  • Loading branch information
nyalldawson committed Nov 27, 2017
1 parent a111a1c commit 60a56c3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/gui/qgsfilterlineedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ QgsFilterLineEdit::QgsFilterLineEdit( QWidget *parent, const QString &nullValue
setMouseTracking( true );

QIcon clearIcon = QgsApplication::getThemeIcon( "/mIconClearText.svg" );
int iconSize = Qgis::UI_SCALE_FACTOR * fontMetrics().height();

// icon size is about 2/3 height of text, but minimum size of 16
int iconSize = std::floor( std::max( Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 0.75, 16.0 ) );

mClearIconSize = QSize( iconSize, iconSize );
mClearIconPixmap = clearIcon.pixmap( mClearIconSize );
QIcon hoverIcon = QgsApplication::getThemeIcon( "/mIconClearTextHover.svg" );
Expand Down

0 comments on commit 60a56c3

Please sign in to comment.