Skip to content

Commit

Permalink
Remove the null representator text on getting focus of `QgsSpinBoxLin…
Browse files Browse the repository at this point in the history
…eEdit`

This fixes #20153
  • Loading branch information
signedav committed Nov 13, 2018
1 parent 6da99a1 commit a02fb08
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/gui/qgsfilterlineedit.cpp
Expand Up @@ -212,3 +212,22 @@ bool QgsFilterLineEdit::event( QEvent *event )

return QLineEdit::event( event );;
}

void QgsSpinBoxLineEdit::focusInEvent( QFocusEvent *e )
{
QLineEdit::focusInEvent( e );
if ( e->reason() == Qt::MouseFocusReason && ( isNull() ) )
{
mWaitingForMouseRelease = true;
}
}

void QgsSpinBoxLineEdit::mouseReleaseEvent( QMouseEvent *e )
{
QLineEdit::mouseReleaseEvent( e );
if ( mWaitingForMouseRelease )
{
mWaitingForMouseRelease = false;
clear();
}
}
8 changes: 8 additions & 0 deletions src/gui/qgsfilterlineedit.h
Expand Up @@ -324,6 +324,14 @@ class SIP_SKIP QgsSpinBoxLineEdit : public QgsFilterLineEdit
setModified( true );
emit cleared();
}

protected:
void focusInEvent( QFocusEvent *e ) override;
void mouseReleaseEvent( QMouseEvent *e ) override;

private:
bool mWaitingForMouseRelease = false;

};
/// @endcond

Expand Down

0 comments on commit a02fb08

Please sign in to comment.