Skip to content
Permalink
Browse files

Remove the null representator text on getting focus of `QgsSpinBoxLin…

…eEdit`

This fixes #20153
  • Loading branch information
signedav committed Nov 13, 2018
1 parent 6da99a1 commit a02fb082908a299bbe7dd472fcdc35343b8f176f
Showing with 27 additions and 0 deletions.
  1. +19 −0 src/gui/qgsfilterlineedit.cpp
  2. +8 −0 src/gui/qgsfilterlineedit.h
@@ -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();
}
}
@@ -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

0 comments on commit a02fb08

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