Skip to content

Commit

Permalink
setReadOnly will call paintEvent, followup ce486da
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Sep 24, 2014
1 parent ce486da commit 1f8584c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
8 changes: 1 addition & 7 deletions src/gui/editorwidgets/qgstexteditwrapper.cpp
Expand Up @@ -139,11 +139,5 @@ void QgsTextEditWrapper::setEnabled( bool enabled )
mPlainTextEdit->setReadOnly( !enabled );

if ( mLineEdit )
{
QgsFilterLineEdit* qgsWidget = dynamic_cast<QgsFilterLineEdit*>( mLineEdit );
if ( qgsWidget )
qgsWidget->setReadOnly( !enabled );
else
mLineEdit->setReadOnly( !enabled );
}
mLineEdit->setReadOnly( !enabled );
}
4 changes: 2 additions & 2 deletions src/gui/qgsfilterlineedit.cpp
Expand Up @@ -84,9 +84,9 @@ void QgsFilterLineEdit::changeEvent( QEvent *e )
btnClear->setVisible( isEnabled() && !isReadOnly() && !isNull() );
}

void QgsFilterLineEdit::setReadOnly( bool readOnly )
void QgsFilterLineEdit::paintEvent( QPaintEvent* e )
{
QLineEdit::setReadOnly( readOnly );
QLineEdit::paintEvent( e );
btnClear->setVisible( isEnabled() && !isReadOnly() && !isNull() );
}

Expand Down
7 changes: 1 addition & 6 deletions src/gui/qgsfilterlineedit.h
Expand Up @@ -58,12 +58,6 @@ class GUI_EXPORT QgsFilterLineEdit : public QLineEdit
*/
inline bool isNull() const { return text() == mNullValue; }

/**
* @brief setReadOnly set the line edit to be read only and hide the clear button
* @note Since QLineEdit::setReadOnly() is not virtual, it needs to be called for QgsFilterLineEdit
*/
void setReadOnly( bool readOnly );

signals:
void cleared();

Expand All @@ -79,6 +73,7 @@ class GUI_EXPORT QgsFilterLineEdit : public QLineEdit
void focusInEvent( QFocusEvent* e );
void resizeEvent( QResizeEvent* e );
void changeEvent( QEvent* e );
void paintEvent( QPaintEvent* e );

private slots:
void clear();
Expand Down

0 comments on commit 1f8584c

Please sign in to comment.