Skip to content
Permalink
Browse files

setReadOnly will call paintEvent, followup ce486da

  • Loading branch information
3nids committed Sep 24, 2014
1 parent ce486da commit 1f8584c77bc6af854bd0cbe8741436e0fd95c6b4
Showing with 4 additions and 15 deletions.
  1. +1 −7 src/gui/editorwidgets/qgstexteditwrapper.cpp
  2. +2 −2 src/gui/qgsfilterlineedit.cpp
  3. +1 −6 src/gui/qgsfilterlineedit.h
@@ -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 );
}
@@ -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() );
}

@@ -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();

@@ -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();

0 comments on commit 1f8584c

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