Skip to content
Permalink
Browse files
regroup onTreeView_clicked
  • Loading branch information
3nids committed Nov 11, 2021
1 parent de436c7 commit 0f39b8215f20d3e5b7d9b7c87fd86528b9dc8eb2
@@ -46,7 +46,6 @@ QgsOgrDbSourceSelect::QgsOgrDbSourceSelect( const QString &theSettingsKey, const
connect( btnDelete, &QPushButton::clicked, this, &QgsOgrDbSourceSelect::btnDelete_clicked );
connect( cbxAllowGeometrylessTables, &QCheckBox::stateChanged, this, &QgsOgrDbSourceSelect::cbxAllowGeometrylessTables_stateChanged );
connect( cmbConnections, static_cast<void ( QComboBox::* )( int )>( &QComboBox::activated ), this, &QgsOgrDbSourceSelect::cmbConnections_activated );
connect( mTablesTreeView, &QTreeView::clicked, this, &QgsOgrDbSourceSelect::mTablesTreeView_clicked );
connect( mTablesTreeView, &QTreeView::doubleClicked, this, &QgsOgrDbSourceSelect::mTablesTreeView_doubleClicked );
setupButtons( buttonBox );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsOgrDbSourceSelect::showHelp );
@@ -104,7 +103,7 @@ void QgsOgrDbSourceSelect::cbxAllowGeometrylessTables_stateChanged( int )
btnConnect_clicked();
}

void QgsOgrDbSourceSelect::mTablesTreeView_clicked( const QModelIndex &index )
void QgsOgrDbSourceSelect::treeviewClicked( const QModelIndex &index )
{
mBuildQueryButton->setEnabled( index.parent().isValid() && mTablesTreeView->currentIndex().data( Qt::UserRole + 2 ) != QLatin1String( "Raster" ) );
}
@@ -90,14 +90,17 @@ class QgsOgrDbSourceSelect: public QgsDbSourceSelectBase
void cbxAllowGeometrylessTables_stateChanged( int );
void setSql( const QModelIndex &index );
void cmbConnections_activated( int );
void mTablesTreeView_clicked( const QModelIndex &index );
void mTablesTreeView_doubleClicked( const QModelIndex &index );
void treeWidgetSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
//!Sets a new regular expression to the model
void setSearchExpression( const QString &regexp );

void showHelp();

private slots:
void treeviewClicked( const QModelIndex &index ) override;


private:
void setConnectionListPosition();
//! Model that acts as datasource for mTableTreeWidget
@@ -97,6 +97,12 @@ void QgsDbSourceSelectBase::init( QgsAbstractDbTableModel *model, QItemDelegate
connect( mSearchTableEdit, &QLineEdit::textChanged, this, [ = ]() {filterResults();} );
}

void QgsDbSourceSelectBase::treeviewClicked( const QModelIndex &index )
{
mBuildQueryButton->setEnabled( index.parent().isValid() );

}


void QgsDbSourceSelectBase::filterResults()
{
@@ -44,6 +44,9 @@ class GUI_EXPORT QgsDbSourceSelectBase : public QgsAbstractDataSourceWidget, pro
//! Returns the proxy model used to filter the results
QSortFilterProxyModel *proxyModel() {return mProxyModel;}

private slots:
virtual void treeviewClicked( const QModelIndex &index );

private:
void filterResults();

@@ -135,7 +135,6 @@ QgsDb2SourceSelect::QgsDb2SourceSelect( QWidget *parent, Qt::WindowFlags fl, Qgs
connect( btnSave, &QPushButton::clicked, this, &QgsDb2SourceSelect::btnSave_clicked );
connect( btnLoad, &QPushButton::clicked, this, &QgsDb2SourceSelect::btnLoad_clicked );
connect( cmbConnections, static_cast<void ( QComboBox::* )( int )>( &QComboBox::activated ), this, &QgsDb2SourceSelect::cmbConnections_activated );
connect( mTablesTreeView, &QTreeView::clicked, this, &QgsDb2SourceSelect::mTablesTreeView_clicked );
connect( mTablesTreeView, &QTreeView::doubleClicked, this, &QgsDb2SourceSelect::mTablesTreeView_doubleClicked );
setupButtons( buttonBox );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsDb2SourceSelect::showHelp );
@@ -275,11 +274,6 @@ void QgsDb2SourceSelect::refresh()
populateConnectionList();
}

void QgsDb2SourceSelect::mTablesTreeView_clicked( const QModelIndex &index )
{
mBuildQueryButton->setEnabled( index.parent().isValid() );
}

void QgsDb2SourceSelect::mTablesTreeView_doubleClicked( const QModelIndex & )
{
addButtonClicked();
@@ -138,7 +138,6 @@ class QgsDb2SourceSelect : public QgsDbSourceSelectBase
//! Store the selected database
void cmbConnections_activated( int );
void setLayerType( const QgsDb2LayerProperty &layerProperty );
void mTablesTreeView_clicked( const QModelIndex &index );
void mTablesTreeView_doubleClicked( const QModelIndex &index );
void treeWidgetSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
//!Sets a new regular expression to the model
@@ -213,7 +213,6 @@ QgsHanaSourceSelect::QgsHanaSourceSelect(
connect( btnLoad, &QPushButton::clicked, this, &QgsHanaSourceSelect::btnLoad_clicked );
connect( cmbConnections, static_cast<void ( QComboBox::* )( int )>( &QComboBox::activated ),
this, &QgsHanaSourceSelect::cmbConnections_activated );
connect( mTablesTreeView, &QTreeView::clicked, this, &QgsHanaSourceSelect::mTablesTreeView_clicked );
connect( mTablesTreeView, &QTreeView::doubleClicked, this, &QgsHanaSourceSelect::mTablesTreeView_doubleClicked );
setupButtons( buttonBox );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsHanaSourceSelect::showHelp );
@@ -344,11 +343,6 @@ void QgsHanaSourceSelect::buildQuery()
setSql( mTablesTreeView->currentIndex() );
}

void QgsHanaSourceSelect::mTablesTreeView_clicked( const QModelIndex &index )
{
mBuildQueryButton->setEnabled( index.parent().isValid() );
}

void QgsHanaSourceSelect::mTablesTreeView_doubleClicked( const QModelIndex &index )
{
const QgsSettings settings;
@@ -116,7 +116,6 @@ class QgsHanaSourceSelect : public QgsDbSourceSelectBase
//! Store the selected database
void cmbConnections_activated( int );
void setLayerType( const QgsHanaLayerProperty &layerProperty );
void mTablesTreeView_clicked( const QModelIndex &index );
void mTablesTreeView_doubleClicked( const QModelIndex &index );
void treeWidgetSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
//!Sets a new regular expression to the model
@@ -137,7 +137,6 @@ QgsMssqlSourceSelect::QgsMssqlSourceSelect( QWidget *parent, Qt::WindowFlags fl,
connect( btnSave, &QPushButton::clicked, this, &QgsMssqlSourceSelect::btnSave_clicked );
connect( btnLoad, &QPushButton::clicked, this, &QgsMssqlSourceSelect::btnLoad_clicked );
connect( cmbConnections, static_cast<void ( QComboBox::* )( int )>( &QComboBox::activated ), this, &QgsMssqlSourceSelect::cmbConnections_activated );
connect( mTablesTreeView, &QTreeView::clicked, this, &QgsMssqlSourceSelect::mTablesTreeView_clicked );
connect( mTablesTreeView, &QTreeView::doubleClicked, this, &QgsMssqlSourceSelect::mTablesTreeView_doubleClicked );
setupButtons( buttonBox );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsMssqlSourceSelect::showHelp );
@@ -273,11 +272,6 @@ void QgsMssqlSourceSelect::buildQuery()
setSql( mTablesTreeView->currentIndex() );
}

void QgsMssqlSourceSelect::mTablesTreeView_clicked( const QModelIndex &index )
{
mBuildQueryButton->setEnabled( index.parent().isValid() );
}

void QgsMssqlSourceSelect::mTablesTreeView_doubleClicked( const QModelIndex & )
{
addButtonClicked();
@@ -111,7 +111,6 @@ class QgsMssqlSourceSelect : public QgsDbSourceSelectBase
//! Store the selected database
void cmbConnections_activated( int );
void setLayerType( const QgsMssqlLayerProperty &layerProperty );
void mTablesTreeView_clicked( const QModelIndex &index );
void mTablesTreeView_doubleClicked( const QModelIndex &index );
void treeWidgetSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
//!Sets a new regular expression to the model
@@ -313,11 +313,6 @@ void QgsOracleSourceSelect::buildQuery()
setSql( mTablesTreeView->currentIndex() );
}

void QgsOracleSourceSelect::on_mTablesTreeView_clicked( const QModelIndex &index )
{
mBuildQueryButton->setEnabled( index.parent().isValid() );
}

void QgsOracleSourceSelect::on_mTablesTreeView_doubleClicked( const QModelIndex & )
{
addButtonClicked();
@@ -118,7 +118,6 @@ class QgsOracleSourceSelect : public QgsDbSourceSelectBase
void setSql( const QModelIndex &index );
//! Store the selected database
void setLayerType( const QgsOracleLayerProperty &layerProperty );
void on_mTablesTreeView_clicked( const QModelIndex &index );
void on_mTablesTreeView_doubleClicked( const QModelIndex &index );
void treeWidgetSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
//!Sets a new regular expression to the model
@@ -227,7 +227,6 @@ QgsPgSourceSelect::QgsPgSourceSelect( QWidget *parent, Qt::WindowFlags fl, QgsPr
connect( btnSave, &QPushButton::clicked, this, &QgsPgSourceSelect::btnSave_clicked );
connect( btnLoad, &QPushButton::clicked, this, &QgsPgSourceSelect::btnLoad_clicked );
connect( cmbConnections, &QComboBox::currentTextChanged, this, &QgsPgSourceSelect::cmbConnections_currentIndexChanged );
connect( mTablesTreeView, &QTreeView::clicked, this, &QgsPgSourceSelect::mTablesTreeView_clicked );
connect( mTablesTreeView, &QTreeView::doubleClicked, this, &QgsPgSourceSelect::mTablesTreeView_doubleClicked );
setupButtons( buttonBox );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsPgSourceSelect::showHelp );
@@ -353,11 +352,6 @@ void QgsPgSourceSelect::buildQuery()
setSql( mTablesTreeView->currentIndex() );
}

void QgsPgSourceSelect::mTablesTreeView_clicked( const QModelIndex &index )
{
mBuildQueryButton->setEnabled( index.parent().isValid() );
}

void QgsPgSourceSelect::mTablesTreeView_doubleClicked( const QModelIndex & )
{
addButtonClicked();
@@ -108,7 +108,6 @@ class QgsPgSourceSelect : public QgsDbSourceSelectBase
void setSql( const QModelIndex &index );
//! Store the selected database
void setLayerType( const QgsPostgresLayerProperty &layerProperty );
void mTablesTreeView_clicked( const QModelIndex &index );
void mTablesTreeView_doubleClicked( const QModelIndex &index );
void treeWidgetSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
//!Sets a new regular expression to the model
@@ -55,7 +55,6 @@ QgsSpatiaLiteSourceSelect::QgsSpatiaLiteSourceSelect( QWidget *parent, Qt::Windo
connect( btnDelete, &QPushButton::clicked, this, &QgsSpatiaLiteSourceSelect::btnDelete_clicked );
connect( cbxAllowGeometrylessTables, &QCheckBox::stateChanged, this, &QgsSpatiaLiteSourceSelect::cbxAllowGeometrylessTables_stateChanged );
connect( cmbConnections, static_cast<void ( QComboBox::* )( int )>( &QComboBox::activated ), this, &QgsSpatiaLiteSourceSelect::cmbConnections_activated );
connect( mTablesTreeView, &QTreeView::clicked, this, &QgsSpatiaLiteSourceSelect::mTablesTreeView_clicked );
connect( mTablesTreeView, &QTreeView::doubleClicked, this, &QgsSpatiaLiteSourceSelect::mTablesTreeView_doubleClicked );
setupButtons( buttonBox );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsSpatiaLiteSourceSelect::showHelp );
@@ -147,11 +146,6 @@ void QgsSpatiaLiteSourceSelect::cbxAllowGeometrylessTables_stateChanged( int )
btnConnect_clicked();
}

void QgsSpatiaLiteSourceSelect::mTablesTreeView_clicked( const QModelIndex &index )
{
mBuildQueryButton->setEnabled( index.parent().isValid() );
}

void QgsSpatiaLiteSourceSelect::mTablesTreeView_doubleClicked( const QModelIndex &index )
{
setSql( index );
@@ -85,7 +85,6 @@ class QgsSpatiaLiteSourceSelect: public QgsDbSourceSelectBase
void setSql( const QModelIndex &index );
void cmbConnections_activated( int );
void setLayerType( const QString &table, const QString &column, const QString &type );
void mTablesTreeView_clicked( const QModelIndex &index );
void mTablesTreeView_doubleClicked( const QModelIndex &index );
void treeWidgetSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
//!Sets a new regular expression to the model

0 comments on commit 0f39b82

Please sign in to comment.