Skip to content
Permalink
Browse files
rename setSourceModel -> init
  • Loading branch information
3nids committed Nov 11, 2021
1 parent f7fc805 commit de436c73466f8ef8e041948a181c7c7afd1f246c
@@ -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
@@ -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 );

@@ -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();
@@ -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;}
@@ -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 );

@@ -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 );
@@ -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 );

@@ -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 );

@@ -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 );

@@ -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 );

0 comments on commit de436c7

Please sign in to comment.