Skip to content

Commit fd6e37c

Browse files
committed
Disable filter if search checkbox is unticked in database selection dialogs (fixes #9168)
1 parent 705927e commit fd6e37c

9 files changed

+37
-0
lines changed

src/core/qgsdbfilterproxymodel.h

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class CORE_EXPORT QgsDbFilterProxyModel: public QSortFilterProxyModel
2727
public:
2828
QgsDbFilterProxyModel( QObject* parent = 0 );
2929
~QgsDbFilterProxyModel();
30+
void setFilterEnabled( bool );
3031
/**Calls QSortFilterProxyModel::setFilterWildcard and triggers update*/
3132
void _setFilterWildcard( const QString& pattern );
3233
/**Calls QSortFilterProxyModel::setFilterRegExp and triggers update*/

src/providers/mssql/qgsmssqlsourceselect.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,14 @@ void QgsMssqlSourceSelect::on_mTablesTreeView_doubleClicked( const QModelIndex &
318318
}
319319
}
320320

321+
void QgsMssqlSourceSelect::on_mSearchGroupBox_toggled( bool checked )
322+
{
323+
if ( mSearchTableEdit->text().isEmpty() )
324+
return;
325+
326+
on_mSearchTableEdit_textChanged( checked ? mSearchTableEdit->text() : "" );
327+
}
328+
321329
void QgsMssqlSourceSelect::on_mSearchTableEdit_textChanged( const QString & text )
322330
{
323331
if ( mSearchModeComboBox->currentText() == tr( "Wildcard" ) )

src/providers/mssql/qgsmssqlsourceselect.h

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ class QgsMssqlSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
130130
void on_btnSave_clicked();
131131
//! Loads the selected connections from file
132132
void on_btnLoad_clicked();
133+
void on_mSearchGroupBox_toggled( bool );
133134
void on_mSearchTableEdit_textChanged( const QString & text );
134135
void on_mSearchColumnComboBox_currentIndexChanged( const QString & text );
135136
void on_mSearchModeComboBox_currentIndexChanged( const QString & text );

src/providers/oracle/qgsoraclesourceselect.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,14 @@ void QgsOracleSourceSelect::on_mTablesTreeView_doubleClicked( const QModelIndex
351351
}
352352
}
353353

354+
void QgsOracleSourceSelect::on_mSearchGroupBox_toggled( bool checked )
355+
{
356+
if ( mSearchTableEdit->text().isEmpty() )
357+
return;
358+
359+
on_mSearchTableEdit_textChanged( checked ? mSearchTableEdit->text() : "" );
360+
}
361+
354362
void QgsOracleSourceSelect::on_mSearchTableEdit_textChanged( const QString & text )
355363
{
356364
if ( mSearchModeComboBox->currentText() == tr( "Wildcard" ) )

src/providers/oracle/qgsoraclesourceselect.h

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class QgsOracleSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
109109
void on_btnSave_clicked();
110110
//! Loads the selected connections from file
111111
void on_btnLoad_clicked();
112+
void on_mSearchGroupBox_toggled( bool );
112113
void on_mSearchTableEdit_textChanged( const QString & text );
113114
void on_mSearchColumnComboBox_currentIndexChanged( const QString & text );
114115
void on_mSearchModeComboBox_currentIndexChanged( const QString & text );

src/providers/postgres/qgspgsourceselect.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,14 @@ void QgsPgSourceSelect::on_mTablesTreeView_doubleClicked( const QModelIndex &ind
335335
}
336336
}
337337

338+
void QgsPgSourceSelect::on_mSearchGroupBox_toggled( bool checked )
339+
{
340+
if ( mSearchTableEdit->text().isEmpty() )
341+
return;
342+
343+
on_mSearchTableEdit_textChanged( checked ? mSearchTableEdit->text() : "" );
344+
}
345+
338346
void QgsPgSourceSelect::on_mSearchTableEdit_textChanged( const QString & text )
339347
{
340348
if ( mSearchModeComboBox->currentText() == tr( "Wildcard" ) )

src/providers/postgres/qgspgsourceselect.h

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ class QgsPgSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
9999
void on_btnSave_clicked();
100100
//! Loads the selected connections from file
101101
void on_btnLoad_clicked();
102+
void on_mSearchGroupBox_toggled( bool );
102103
void on_mSearchTableEdit_textChanged( const QString & text );
103104
void on_mSearchColumnComboBox_currentIndexChanged( const QString & text );
104105
void on_mSearchModeComboBox_currentIndexChanged( const QString & text );

src/providers/spatialite/qgsspatialitesourceselect.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,14 @@ void QgsSpatiaLiteSourceSelect::on_mTablesTreeView_doubleClicked( const QModelIn
181181
setSql( index );
182182
}
183183

184+
void QgsSpatiaLiteSourceSelect::on_mSearchGroupBox_toggled( bool checked )
185+
{
186+
if ( mSearchTableEdit->text().isEmpty() )
187+
return;
188+
189+
on_mSearchTableEdit_textChanged( checked ? mSearchTableEdit->text() : "" );
190+
}
191+
184192
void QgsSpatiaLiteSourceSelect::on_mSearchTableEdit_textChanged( const QString & text )
185193
{
186194
if ( mSearchModeComboBox->currentText() == tr( "Wildcard" ) )

src/providers/spatialite/qgsspatialitesourceselect.h

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class QgsSpatiaLiteSourceSelect: public QDialog, private Ui::QgsDbSourceSelectBa
8080
void on_btnNew_clicked();
8181
//! Deletes the selected connection
8282
void on_btnDelete_clicked();
83+
void on_mSearchGroupBox_toggled( bool );
8384
void on_mSearchTableEdit_textChanged( const QString & text );
8485
void on_mSearchColumnComboBox_currentIndexChanged( const QString & text );
8586
void on_mSearchModeComboBox_currentIndexChanged( const QString & text );

0 commit comments

Comments
 (0)