Skip to content
Permalink
Browse files
regroup onTreeView_doubleClicked
  • Loading branch information
3nids committed Nov 11, 2021
1 parent 67bcb31 commit 984303825867698bac713bb5f6bfff38065743b2
@@ -40,6 +40,7 @@ Returns the proxy model used to filter the results

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

@@ -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::doubleClicked, this, &QgsOgrDbSourceSelect::mTablesTreeView_doubleClicked );
setupButtons( buttonBox );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsOgrDbSourceSelect::showHelp );

@@ -97,7 +96,7 @@ void QgsOgrDbSourceSelect::treeviewClicked( const QModelIndex &index )
mBuildQueryButton->setEnabled( index.parent().isValid() && mTablesTreeView->currentIndex().data( Qt::UserRole + 2 ) != QLatin1String( "Raster" ) );
}

void QgsOgrDbSourceSelect::mTablesTreeView_doubleClicked( const QModelIndex &index )
void QgsOgrDbSourceSelect::treeviewDoubleClicked( const QModelIndex &index )
{
setSql( index );
}
@@ -88,7 +88,6 @@ class QgsOgrDbSourceSelect: public QgsDbSourceSelectBase
void btnDelete_clicked();
void cbxAllowGeometrylessTables_stateChanged( int );
void cmbConnections_activated( int );
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 );
@@ -98,6 +97,7 @@ class QgsOgrDbSourceSelect: public QgsDbSourceSelectBase
protected slots:
void treeviewClicked( const QModelIndex &index ) override;
void setSql( const QModelIndex &index ) override;
void treeviewDoubleClicked( const QModelIndex &index ) override;

private:
void setConnectionListPosition();
@@ -44,6 +44,10 @@ QgsDbSourceSelectBase::QgsDbSourceSelectBase( QWidget *parent, Qt::WindowFlags f
mBuildQueryButton->setToolTip( tr( "Set Filter" ) );
mBuildQueryButton->setDisabled( true );
buttonBox->addButton( mBuildQueryButton, QDialogButtonBox::ActionRole );

connect( mTablesTreeView, &QTreeView::clicked, this, &QgsDbSourceSelectBase::treeviewClicked );
connect( mTablesTreeView, &QTreeView::doubleClicked, this, &QgsDbSourceSelectBase::treeviewDoubleClicked );

connect( mBuildQueryButton, &QAbstractButton::clicked, this, &QgsDbSourceSelectBase::buildQuery );
}

@@ -108,6 +112,12 @@ void QgsDbSourceSelectBase::treeviewClicked( const QModelIndex &index )
mBuildQueryButton->setEnabled( index.parent().isValid() );
}

void QgsDbSourceSelectBase::treeviewDoubleClicked( const QModelIndex &index )
{
Q_UNUSED( index )
addButtonClicked();
}

void QgsDbSourceSelectBase::buildQuery()
{
setSql( mTablesTreeView->currentIndex() );
@@ -46,6 +46,7 @@ class GUI_EXPORT QgsDbSourceSelectBase : public QgsAbstractDataSourceWidget, pro

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

@@ -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::doubleClicked, this, &QgsDb2SourceSelect::mTablesTreeView_doubleClicked );
setupButtons( buttonBox );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsDb2SourceSelect::showHelp );

@@ -259,11 +258,6 @@ void QgsDb2SourceSelect::refresh()
populateConnectionList();
}

void QgsDb2SourceSelect::mTablesTreeView_doubleClicked( const QModelIndex & )
{
addButtonClicked();
}

void QgsDb2SourceSelect::setLayerType( const QgsDb2LayerProperty &layerProperty )
{
mTableModel->setGeometryTypesForTable( layerProperty );
@@ -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::doubleClicked, this, &QgsHanaSourceSelect::mTablesTreeView_doubleClicked );
setupButtons( buttonBox );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsHanaSourceSelect::showHelp );

@@ -328,7 +327,7 @@ void QgsHanaSourceSelect::cbxAllowGeometrylessTables_stateChanged( int )
btnConnect_clicked();
}

void QgsHanaSourceSelect::mTablesTreeView_doubleClicked( const QModelIndex &index )
void QgsHanaSourceSelect::treeviewDoubleClicked( const QModelIndex &index )
{
const QgsSettings settings;
if ( settings.value( QStringLiteral( "qgis/addHANADC" ), false ).toBool() )
@@ -113,7 +113,6 @@ class QgsHanaSourceSelect : public QgsDbSourceSelectBase
//! Store the selected database
void cmbConnections_activated( int );
void setLayerType( const QgsHanaLayerProperty &layerProperty );
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 );
@@ -122,6 +121,7 @@ class QgsHanaSourceSelect : public QgsDbSourceSelectBase

protected slots:
void setSql( const QModelIndex &index ) override;
void treeviewDoubleClicked( const QModelIndex &index ) override;

private:
// Set the position of the database connection list to the last
@@ -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::doubleClicked, this, &QgsMssqlSourceSelect::mTablesTreeView_doubleClicked );
setupButtons( buttonBox );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsMssqlSourceSelect::showHelp );

@@ -256,11 +255,6 @@ void QgsMssqlSourceSelect::cbxAllowGeometrylessTables_stateChanged( int )
btnConnect_clicked();
}

void QgsMssqlSourceSelect::mTablesTreeView_doubleClicked( const QModelIndex & )
{
addButtonClicked();
}

void QgsMssqlSourceSelect::setLayerType( const QgsMssqlLayerProperty &layerProperty )
{
mTableModel->setGeometryTypesForTable( layerProperty );
@@ -109,7 +109,6 @@ class QgsMssqlSourceSelect : public QgsDbSourceSelectBase
//! Store the selected database
void cmbConnections_activated( int );
void setLayerType( const QgsMssqlLayerProperty &layerProperty );
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 );
@@ -298,11 +298,6 @@ void QgsOracleSourceSelect::on_cbxAllowGeometrylessTables_stateChanged( int )
on_btnConnect_clicked();
}

void QgsOracleSourceSelect::on_mTablesTreeView_doubleClicked( const QModelIndex & )
{
addButtonClicked();
}

void QgsOracleSourceSelect::setLayerType( const QgsOracleLayerProperty &layerProperty )
{
mTableModel->addTableEntry( layerProperty );
@@ -116,7 +116,6 @@ class QgsOracleSourceSelect : public QgsDbSourceSelectBase
void on_cmbConnections_currentIndexChanged( const QString &text );
//! Store the selected database
void setLayerType( const QgsOracleLayerProperty &layerProperty );
void on_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 );
@@ -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::doubleClicked, this, &QgsPgSourceSelect::mTablesTreeView_doubleClicked );
setupButtons( buttonBox );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsPgSourceSelect::showHelp );

@@ -337,11 +336,6 @@ void QgsPgSourceSelect::cbxAllowGeometrylessTables_stateChanged( int )
btnConnect_clicked();
}

void QgsPgSourceSelect::mTablesTreeView_doubleClicked( const QModelIndex & )
{
addButtonClicked();
}

void QgsPgSourceSelect::setLayerType( const QgsPostgresLayerProperty &layerProperty )
{
mTableModel->addTableEntry( layerProperty );
@@ -106,7 +106,6 @@ class QgsPgSourceSelect : public QgsDbSourceSelectBase
void cmbConnections_currentIndexChanged( const QString &text );
//! Store the selected database
void setLayerType( const QgsPostgresLayerProperty &layerProperty );
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 );
@@ -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::doubleClicked, this, &QgsSpatiaLiteSourceSelect::mTablesTreeView_doubleClicked );
setupButtons( buttonBox );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsSpatiaLiteSourceSelect::showHelp );

@@ -136,7 +135,7 @@ void QgsSpatiaLiteSourceSelect::cbxAllowGeometrylessTables_stateChanged( int )
btnConnect_clicked();
}

void QgsSpatiaLiteSourceSelect::mTablesTreeView_doubleClicked( const QModelIndex &index )
void QgsSpatiaLiteSourceSelect::treeviewDoubleClicked( const QModelIndex &index )
{
setSql( index );
}
@@ -92,6 +92,7 @@ class QgsSpatiaLiteSourceSelect: public QgsDbSourceSelectBase

protected slots:
void setSql( const QModelIndex &index ) override;
void treeviewDoubleClicked( const QModelIndex &index ) override;

private:
enum Columns

0 comments on commit 9843038

Please sign in to comment.