Skip to content

Commit

Permalink
Double click to add single layer
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 12, 2021
1 parent 5e41371 commit 1321b33
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app/qgsprovidersublayersdialog.cpp
Expand Up @@ -157,7 +157,14 @@ QgsProviderSublayersDialog::QgsProviderSublayersDialog( const QString &uri, cons
connect( mBtnDeselectAll, &QAbstractButton::pressed, this, [ = ] { mLayersTree->selectionModel()->clear(); } );
connect( mLayersTree->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsProviderSublayersDialog::treeSelectionChanged );
connect( mSearchLineEdit, &QgsFilterLineEdit::textChanged, mProxyModel, &QgsProviderSublayerProxyModel::setFilterString );

connect( mLayersTree, &QTreeView::doubleClicked, this, [ = ]( const QModelIndex & index )
{
mLayersTree->selectionModel()->select( QItemSelection( mLayersTree->model()->index( index.row(), 0, index.parent() ),
mLayersTree->model()->index( index.row(), mLayersTree->model()->columnCount() - 1, index.parent() ) ),
QItemSelectionModel::ClearAndSelect );
emit layersAdded( selectedLayers() );
accept();
} );
connect( mButtonBox, &QDialogButtonBox::rejected, this, &QDialog::reject );
connect( mButtonBox, &QDialogButtonBox::accepted, this, [ = ]
{
Expand Down

0 comments on commit 1321b33

Please sign in to comment.