Skip to content

Commit

Permalink
hide clear button in filter line edit, when widget is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Mar 14, 2013
1 parent a1b5b92 commit 7e598f7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/qgsattributedialog.cpp
Expand Up @@ -204,7 +204,7 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat

if ( vl->editType( fldIdx ) != QgsVectorLayer::Immutable )
{
myWidget->setEnabled( vl->isEditable() && vl->fieldEditable(fldIdx) );
myWidget->setEnabled( vl->isEditable() && vl->fieldEditable( fldIdx ) );
}

mypInnerLayout->addWidget( myWidget, index, 1 );
Expand Down Expand Up @@ -239,7 +239,7 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat

if ( vl->editType( fldIdx ) != QgsVectorLayer::Immutable )
{
( *itw )->setEnabled( (*itw)->isEnabled() && vl->isEditable() && vl->fieldEditable( fldIdx ) );
( *itw )->setEnabled(( *itw )->isEnabled() && vl->isEditable() && vl->fieldEditable( fldIdx ) );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsattributeeditor.cpp
Expand Up @@ -1195,6 +1195,6 @@ void QgsStringRelay::changeText( QString str )
connect( this, SIGNAL( textChanged( QString ) ), sObj, sSlot );
for ( int i = 0; i < mProxyList.size(); ++i )
{
( mProxyList[i] )->blockSignals( oldBlockSigs[i] );
mProxyList[i]->blockSignals( oldBlockSigs[i] );
}
}
9 changes: 9 additions & 0 deletions src/gui/qgsfilterlineedit.cpp
Expand Up @@ -59,6 +59,15 @@ void QgsFilterLineEdit::clear()
setModified( true );
}

void QgsFilterLineEdit::changeEvent( QEvent *e )
{
QLineEdit::changeEvent( e );
if ( !isEnabled() )
btnClear->setVisible( false );
else
btnClear->setVisible( text() != mNullValue );
}

void QgsFilterLineEdit::toggleClearButton( const QString &text )
{
btnClear->setVisible( !isReadOnly() && text != mNullValue );
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgsfilterlineedit.h
Expand Up @@ -38,6 +38,7 @@ class GUI_EXPORT QgsFilterLineEdit : public QLineEdit

protected:
void resizeEvent( QResizeEvent * );
void changeEvent( QEvent * );

private slots:
void clear();
Expand Down

0 comments on commit 7e598f7

Please sign in to comment.