Skip to content

Commit

Permalink
[widget editor] enable returnPressed signal for the search widget
Browse files Browse the repository at this point in the history
  • Loading branch information
slarosa committed Sep 16, 2015
1 parent a62c6a9 commit 9acfe52
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app/qgsattributetabledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ void QgsAttributeTableDialog::filterColumnChanged( QObject* filterAction )
}
else
{
connect( mCurrentSearchWidgetWrapper, SIGNAL( expressionChanged() ), SLOT( filterQueryAccepted() ) );
mApplyFilterButton->setVisible( true );
}

Expand Down Expand Up @@ -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 );
}
Expand Down
1 change: 1 addition & 0 deletions src/gui/editorwidgets/core/qgssearchwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
6 changes: 6 additions & 0 deletions src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -105,3 +106,8 @@ bool QgsDefaultSearchWidgetWrapper::valid()
{
return true;
}

void QgsDefaultSearchWidgetWrapper::filterChanged()
{
emit expressionChanged();
}
2 changes: 2 additions & 0 deletions src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9acfe52

Please sign in to comment.