Skip to content
Permalink
Browse files

[ui][bugfix] lineedit add margin for X icon

Backported from master PR 5707

Fixes #17262
  • Loading branch information
elpaso committed Nov 27, 2017
1 parent 5631094 commit 106b8b634d331c021c23d56b29abc423998699fd
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/gui/qgsfilterlineedit.cpp
@@ -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& ) ) );
}

0 comments on commit 106b8b6

Please sign in to comment.
You can’t perform that action at this time.