Skip to content

Commit

Permalink
rename setSourceModel -> init
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Nov 11, 2021
1 parent f7fc805 commit de436c7
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 13 deletions.
Expand Up @@ -28,7 +28,7 @@ Constructor
%End

protected:
void setSourceModel( QgsAbstractDbTableModel *model, QItemDelegate *delegate = 0 );
void init( QgsAbstractDbTableModel *model, QItemDelegate *delegate = 0 );
%Docstring
Sets the source model for the table and optionally a delegate
%End
Expand Down
2 changes: 1 addition & 1 deletion src/gui/providers/ogr/qgsogrdbsourceselect.cpp
Expand Up @@ -73,7 +73,7 @@ QgsOgrDbSourceSelect::QgsOgrDbSourceSelect( const QString &theSettingsKey, const
populateConnectionList();

mTableModel = new QgsOgrDbTableModel( this );
setSourceModel( mTableModel );
init( mTableModel );

connect( mTablesTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsOgrDbSourceSelect::treeWidgetSelectionChanged );

Expand Down
5 changes: 1 addition & 4 deletions src/gui/providers/qgsdbsourceselectbase.cpp
Expand Up @@ -36,21 +36,18 @@ QgsDbSourceSelectBase::QgsDbSourceSelectBase( QWidget *parent, Qt::WindowFlags f
// The list gets sorted in finishList() method when the listing of tables and views has finished.
mProxyModel->setDynamicSortFilter( false );


mTablesTreeView->setSortingEnabled( true );
mTablesTreeView->setUniformRowHeights( true );
mTablesTreeView->setEditTriggers( QAbstractItemView::CurrentChanged );
}

void QgsDbSourceSelectBase::setSourceModel( QgsAbstractDbTableModel *model, QItemDelegate *delegate )
void QgsDbSourceSelectBase::init( QgsAbstractDbTableModel *model, QItemDelegate *delegate )
{
mProxyModel->setSourceModel( model );
mTablesTreeView->setModel( mProxyModel );
mTablesTreeView->setItemDelegate( delegate );


// setting the search coluns in search settings menu using the model header data

if ( mSearchSettingsMenu )
mSearchSettingsMenu->deleteLater();
mSearchColumnActions.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/providers/qgsdbsourceselectbase.h
Expand Up @@ -39,7 +39,7 @@ class GUI_EXPORT QgsDbSourceSelectBase : public QgsAbstractDataSourceWidget, pro

protected:
//! Sets the source model for the table and optionally a delegate
void setSourceModel( QgsAbstractDbTableModel *model, QItemDelegate *delegate = nullptr );
void init( QgsAbstractDbTableModel *model, QItemDelegate *delegate = nullptr );

//! Returns the proxy model used to filter the results
QSortFilterProxyModel *proxyModel() {return mProxyModel;}
Expand Down
2 changes: 1 addition & 1 deletion src/providers/db2/qgsdb2sourceselect.cpp
Expand Up @@ -160,7 +160,7 @@ QgsDb2SourceSelect::QgsDb2SourceSelect( QWidget *parent, Qt::WindowFlags fl, Qgs
populateConnectionList();

mTableModel = new QgsDb2TableModel( this );
setSourceModel( mTableModel, new QgsDb2SourceSelectDelegate( this ) );
init( mTableModel, new QgsDb2SourceSelectDelegate( this ) );

connect( mTablesTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsDb2SourceSelect::treeWidgetSelectionChanged );

Expand Down
2 changes: 1 addition & 1 deletion src/providers/hana/qgshanasourceselect.cpp
Expand Up @@ -236,7 +236,7 @@ QgsHanaSourceSelect::QgsHanaSourceSelect(
populateConnectionList();

mTableModel = new QgsHanaTableModel( this );
setSourceModel( mTableModel, new QgsHanaSourceSelectDelegate( this ) );
init( mTableModel, new QgsHanaSourceSelectDelegate( this ) );

connect( mTablesTreeView->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &QgsHanaSourceSelect::treeWidgetSelectionChanged );
Expand Down
2 changes: 1 addition & 1 deletion src/providers/mssql/qgsmssqlsourceselect.cpp
Expand Up @@ -165,7 +165,7 @@ QgsMssqlSourceSelect::QgsMssqlSourceSelect( QWidget *parent, Qt::WindowFlags fl,
populateConnectionList();

mTableModel = new QgsMssqlTableModel( this );
setSourceModel( mTableModel, new QgsMssqlSourceSelectDelegate( this ) );
init( mTableModel, new QgsMssqlSourceSelectDelegate( this ) );

connect( mTablesTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsMssqlSourceSelect::treeWidgetSelectionChanged );

Expand Down
2 changes: 1 addition & 1 deletion src/providers/oracle/qgsoraclesourceselect.cpp
Expand Up @@ -202,7 +202,7 @@ QgsOracleSourceSelect::QgsOracleSourceSelect( QWidget *parent, Qt::WindowFlags f


mTableModel = new QgsOracleTableModel( this );
setSourceModel( mTableModel, mTablesTreeDelegate );
init( mTableModel, mTablesTreeDelegate );

connect( mTablesTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsOracleSourceSelect::treeWidgetSelectionChanged );

Expand Down
2 changes: 1 addition & 1 deletion src/providers/postgres/qgspgsourceselect.cpp
Expand Up @@ -255,7 +255,7 @@ QgsPgSourceSelect::QgsPgSourceSelect( QWidget *parent, Qt::WindowFlags fl, QgsPr


mTableModel = new QgsPgTableModel( this );
setSourceModel( mTableModel, new QgsPgSourceSelectDelegate( this ) );
init( mTableModel, new QgsPgSourceSelectDelegate( this ) );

connect( mTablesTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsPgSourceSelect::treeWidgetSelectionChanged );

Expand Down
2 changes: 1 addition & 1 deletion src/providers/spatialite/qgsspatialitesourceselect.cpp
Expand Up @@ -88,7 +88,7 @@ QgsSpatiaLiteSourceSelect::QgsSpatiaLiteSourceSelect( QWidget *parent, Qt::Windo
populateConnectionList();

mTableModel = new QgsSpatiaLiteTableModel( this );
setSourceModel( mTableModel );
init( mTableModel );

connect( mTablesTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsSpatiaLiteSourceSelect::treeWidgetSelectionChanged );

Expand Down

0 comments on commit de436c7

Please sign in to comment.