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
Expand Up @@ -469,6 +469,7 @@ void QgsAttributeTableDialog::filterColumnChanged( QObject* filterAction )
} }
else else
{ {
connect( mCurrentSearchWidgetWrapper, SIGNAL( expressionChanged() ), SLOT( filterQueryAccepted() ) );
mApplyFilterButton->setVisible( true ); mApplyFilterButton->setVisible( true );
} }


Expand Down Expand Up @@ -504,6 +505,10 @@ void QgsAttributeTableDialog::filterShowAll()
mFilterButton->setDefaultAction( mActionShowAllFilter ); mFilterButton->setDefaultAction( mActionShowAllFilter );
mFilterButton->setPopupMode( QToolButton::InstantPopup ); mFilterButton->setPopupMode( QToolButton::InstantPopup );
mFilterQuery->setVisible( false ); mFilterQuery->setVisible( false );
if ( mCurrentSearchWidgetWrapper != 0 )
{
mCurrentSearchWidgetWrapper->widget()->setVisible( false );
}
mApplyFilterButton->setVisible( false ); mApplyFilterButton->setVisible( false );
mMainView->setFilterMode( QgsAttributeTableFilterModel::ShowAll ); mMainView->setFilterMode( QgsAttributeTableFilterModel::ShowAll );
} }
Expand Down
1 change: 1 addition & 0 deletions src/gui/editorwidgets/core/qgssearchwidgetwrapper.h
Expand Up @@ -70,6 +70,7 @@ class GUI_EXPORT QgsSearchWidgetWrapper : public QgsWidgetWrapper
signals: signals:


void expressionChanged( QString exp ); 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: protected slots:


Expand Down
6 changes: 6 additions & 0 deletions src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.cpp
Expand Up @@ -96,6 +96,7 @@ void QgsDefaultSearchWidgetWrapper::initWidget( QWidget* widget )
mContainer->layout()->addWidget( mLineEdit ); mContainer->layout()->addWidget( mLineEdit );
mContainer->layout()->addWidget( mCheckbox ); mContainer->layout()->addWidget( mCheckbox );
connect( mLineEdit, SIGNAL( textChanged( QString ) ), this, SLOT( setExpression( QString ) ) ); 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 ) ) ); connect( mCheckbox, SIGNAL( stateChanged( int ) ), this, SLOT( setCaseString( int ) ) );
mCheckbox->setChecked( Qt::Unchecked ); mCheckbox->setChecked( Qt::Unchecked );
mCaseString = "ILIKE"; mCaseString = "ILIKE";
Expand All @@ -105,3 +106,8 @@ bool QgsDefaultSearchWidgetWrapper::valid()
{ {
return true; return true;
} }

void QgsDefaultSearchWidgetWrapper::filterChanged()
{
emit expressionChanged();
}
2 changes: 2 additions & 0 deletions src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.h
Expand Up @@ -36,11 +36,13 @@ class GUI_EXPORT QgsDefaultSearchWidgetWrapper : public QgsSearchWidgetWrapper
public: public:
QString expression() override; QString expression() override;
bool applyDirectly() override; bool applyDirectly() override;

protected slots: protected slots:
void setExpression( QString exp ) override; void setExpression( QString exp ) override;


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


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

0 comments on commit 9acfe52

Please sign in to comment.