Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[QgsFilterLineEdit] disable clear action when read only
  • Loading branch information
3nids committed Mar 10, 2018
1 parent b5566bc commit 3d6cd2b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
9 changes: 9 additions & 0 deletions python/gui/qgsfilterlineedit.sip.in
Expand Up @@ -213,6 +213,15 @@ Will select all text when this widget receives the focus.
.. versionadded:: 3.0
%End


virtual bool event( QEvent *event );
%Docstring
Reimplemented to enable/disable the clear action
depending on read-only status

.. versionadded:: 3.0.1
%End

public slots:

virtual void clearValue();
Expand Down
8 changes: 8 additions & 0 deletions src/gui/qgsfilterlineedit.cpp
Expand Up @@ -178,3 +178,11 @@ bool QgsFilterLineEdit::shouldShowClear() const
}
return false; //avoid warnings
}

bool QgsFilterLineEdit::event( QEvent *event )
{
if ( event->type() == QEvent::ReadOnlyChange )
updateClearIcon();

return QLineEdit::event( event );;
}
9 changes: 9 additions & 0 deletions src/gui/qgsfilterlineedit.h
Expand Up @@ -213,6 +213,15 @@ class GUI_EXPORT QgsFilterLineEdit : public QLineEdit
*/
void setSelectOnFocus( bool selectOnFocus );


/**
* Reimplemented to enable/disable the clear action
* depending on read-only status
*
* \since QGIS 3.0.1
*/
virtual bool event( QEvent *event ) override;

public slots:

/**
Expand Down

0 comments on commit 3d6cd2b

Please sign in to comment.