Skip to content
Permalink
Browse files

[widget editor] enable returnPressed signal for the search widget

  • Loading branch information
slarosa committed Sep 16, 2015
1 parent a62c6a9 commit 9acfe52f828e4ac1d70eb8c666aaf788caa12af3
@@ -469,6 +469,7 @@ void QgsAttributeTableDialog::filterColumnChanged( QObject* filterAction )
}
else
{
connect( mCurrentSearchWidgetWrapper, SIGNAL( expressionChanged() ), SLOT( filterQueryAccepted() ) );
mApplyFilterButton->setVisible( true );
}

@@ -504,6 +505,10 @@ void QgsAttributeTableDialog::filterShowAll()
mFilterButton->setDefaultAction( mActionShowAllFilter );
mFilterButton->setPopupMode( QToolButton::InstantPopup );
mFilterQuery->setVisible( false );
if ( mCurrentSearchWidgetWrapper != 0 )
{
mCurrentSearchWidgetWrapper->widget()->setVisible( false );
}
mApplyFilterButton->setVisible( false );
mMainView->setFilterMode( QgsAttributeTableFilterModel::ShowAll );
}
@@ -70,6 +70,7 @@ class GUI_EXPORT QgsSearchWidgetWrapper : public QgsWidgetWrapper
signals:

void expressionChanged( QString exp );
void expressionChanged();

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Sep 16, 2015

Member

@slarosa Just realized that you added a second signal here. I think there should either be always both signals emitted or better, just the one with the string.
Currently one has to connect to both signals to be sure to get a notification when the expression changes.


protected slots:

@@ -96,6 +96,7 @@ void QgsDefaultSearchWidgetWrapper::initWidget( QWidget* widget )
mContainer->layout()->addWidget( mLineEdit );
mContainer->layout()->addWidget( mCheckbox );
connect( mLineEdit, SIGNAL( textChanged( QString ) ), this, SLOT( setExpression( QString ) ) );
connect( mLineEdit, SIGNAL( returnPressed() ), this, SLOT( filterChanged() ) );
connect( mCheckbox, SIGNAL( stateChanged( int ) ), this, SLOT( setCaseString( int ) ) );
mCheckbox->setChecked( Qt::Unchecked );
mCaseString = "ILIKE";
@@ -105,3 +106,8 @@ bool QgsDefaultSearchWidgetWrapper::valid()
{
return true;
}

void QgsDefaultSearchWidgetWrapper::filterChanged()
{
emit expressionChanged();
}
@@ -36,11 +36,13 @@ class GUI_EXPORT QgsDefaultSearchWidgetWrapper : public QgsSearchWidgetWrapper
public:
QString expression() override;
bool applyDirectly() override;

protected slots:
void setExpression( QString exp ) override;

private slots:
void setCaseString( int );
void filterChanged();

protected:
QWidget* createWidget( QWidget* parent ) override;

0 comments on commit 9acfe52

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