Skip to content
Permalink
Browse files
add doc and remove useless method
  • Loading branch information
3nids committed Nov 12, 2021
1 parent e29ea5f commit efb89f893dcc3a97ed3127c5b4dcbf854e83651c
@@ -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();

};

@@ -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 )
@@ -118,12 +118,6 @@ void QgsDbSourceSelectBase::treeviewDoubleClicked( const QModelIndex &index )
addButtonClicked();
}

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


void QgsDbSourceSelectBase::filterResults()
{
QString searchText = mSearchTableEdit->text();
@@ -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();

0 comments on commit efb89f8

Please sign in to comment.