Skip to content

Commit

Permalink
add doc and remove useless method
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Nov 12, 2021
1 parent e29ea5f commit efb89f8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
Expand Up @@ -39,10 +39,13 @@ Returns the proxy model used to filter the results
%End

protected slots:
virtual void setSql( const QModelIndex &index ) = 0;
%Docstring
This is called to define the SQL query and must be re-implemented. The implementation should call :py:class:`QgsAbstractDbTableModel`.setSql
%End

virtual void treeviewClicked( const QModelIndex &index );
virtual void treeviewDoubleClicked( const QModelIndex &index );
virtual void setSql( const QModelIndex &index ) = 0;
void buildQuery();

};

Expand Down
8 changes: 1 addition & 7 deletions src/gui/providers/qgsdbsourceselectbase.cpp
Expand Up @@ -48,7 +48,7 @@ QgsDbSourceSelectBase::QgsDbSourceSelectBase( QWidget *parent, Qt::WindowFlags f
connect( mTablesTreeView, &QTreeView::clicked, this, &QgsDbSourceSelectBase::treeviewClicked );
connect( mTablesTreeView, &QTreeView::doubleClicked, this, &QgsDbSourceSelectBase::treeviewDoubleClicked );

connect( mBuildQueryButton, &QAbstractButton::clicked, this, &QgsDbSourceSelectBase::buildQuery );
connect( mBuildQueryButton, &QAbstractButton::clicked, this, [ = ]() {setSql( mTablesTreeView->currentIndex() );} );
}

void QgsDbSourceSelectBase::init( QgsAbstractDbTableModel *model, QItemDelegate *delegate )
Expand Down Expand Up @@ -118,12 +118,6 @@ void QgsDbSourceSelectBase::treeviewDoubleClicked( const QModelIndex &index )
addButtonClicked();
}

void QgsDbSourceSelectBase::buildQuery()
{
setSql( mTablesTreeView->currentIndex() );
}


void QgsDbSourceSelectBase::filterResults()
{
QString searchText = mSearchTableEdit->text();
Expand Down
5 changes: 3 additions & 2 deletions src/gui/providers/qgsdbsourceselectbase.h
Expand Up @@ -45,10 +45,11 @@ class GUI_EXPORT QgsDbSourceSelectBase : public QgsAbstractDataSourceWidget, pro
QSortFilterProxyModel *proxyModel() {return mProxyModel;}

protected slots:
//! This is called to define the SQL query and must be re-implemented. The implementation should call QgsAbstractDbTableModel::setSql
virtual void setSql( const QModelIndex &index ) = 0;

virtual void treeviewClicked( const QModelIndex &index );
virtual void treeviewDoubleClicked( const QModelIndex &index );
virtual void setSql( const QModelIndex &index ) = 0;
void buildQuery();

private:
void filterResults();
Expand Down

0 comments on commit efb89f8

Please sign in to comment.