Skip to content

Commit

Permalink
Merge pull request #5746 from elpaso/backport-pr-5707
Browse files Browse the repository at this point in the history
[ui][bugfix] lineedit add margin for X icon
  • Loading branch information
elpaso committed Nov 28, 2017
2 parents 9204905 + 106b8b6 commit 2499a20
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/gui/qgsfilterlineedit.cpp
Expand Up @@ -35,11 +35,15 @@ QgsFilterLineEdit::QgsFilterLineEdit( QWidget* parent, const QString& nullValue
setMouseTracking( true );

QIcon clearIcon = QgsApplication::getThemeIcon( "/mIconClearText.svg" );
mClearIconSize = QSize( 16, 16 );
int size = fontMetrics().height();
mClearIconSize = QSize( size, size );
mClearIconPixmap = clearIcon.pixmap( mClearIconSize );
QIcon hoverIcon = QgsApplication::getThemeIcon( "/mIconClearTextHover.svg" );
mClearHoverPixmap = hoverIcon.pixmap( mClearIconSize );

// Make some space for the clear icon
QMargins margins( textMargins( ) );
margins.setRight( size );
setTextMargins( margins );
connect( this, SIGNAL( textChanged( const QString& ) ), this,
SLOT( onTextChanged( const QString& ) ) );
}
Expand Down

0 comments on commit 2499a20

Please sign in to comment.