Skip to content

Commit 340f7ab

Browse files
authored
Merge pull request #5616 from boundlessgeo/datasource-manager-add-close
[gui] Datasource manager remove Ok and add Close
2 parents b95588c + f177ba3 commit 340f7ab

File tree

4 files changed

+5
-29
lines changed

4 files changed

+5
-29
lines changed

python/gui/qgsabstractdatasourcewidget.sip

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ Destructor
5353
being added.
5454
%End
5555

56-
virtual void okButtonClicked();
57-
%Docstring
58-
Triggered when the dialog is accepted, call addButtonClicked() and
59-
emit the accepted() signal
60-
%End
6156

6257
signals:
6358

src/gui/qgsabstractdatasourcewidget.cpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,17 @@ const QgsMapCanvas *QgsAbstractDataSourceWidget::mapCanvas() const
3838
void QgsAbstractDataSourceWidget::setupButtons( QDialogButtonBox *buttonBox )
3939
{
4040

41-
if ( mWidgetMode == QgsProviderRegistry::WidgetMode::None )
42-
{
43-
QPushButton *closeButton = new QPushButton( tr( "&Close" ) );
44-
buttonBox->addButton( closeButton, QDialogButtonBox::ApplyRole );
45-
connect( closeButton, &QPushButton::clicked, this, &QgsAbstractDataSourceWidget::addButtonClicked );
46-
}
47-
4841
mAddButton = new QPushButton( tr( "&Add" ) );
4942
mAddButton->setToolTip( tr( "Add selected layers to map" ) );
5043
mAddButton->setEnabled( false );
5144
buttonBox->addButton( mAddButton, QDialogButtonBox::ApplyRole );
5245
connect( mAddButton, &QPushButton::clicked, this, &QgsAbstractDataSourceWidget::addButtonClicked );
5346
connect( this, &QgsAbstractDataSourceWidget::enableButtons, mAddButton, &QPushButton::setEnabled );
5447

55-
QPushButton *okButton = new QPushButton( tr( "&Ok" ) );
56-
okButton->setToolTip( tr( "Add selected layers to map and close this dialog" ) );
57-
okButton->setEnabled( false );
58-
buttonBox->addButton( okButton, QDialogButtonBox::AcceptRole );
59-
connect( okButton, &QPushButton::clicked, this, &QgsAbstractDataSourceWidget::okButtonClicked );
60-
connect( this, &QgsAbstractDataSourceWidget::enableButtons, okButton, &QPushButton::setEnabled );
48+
QPushButton *closeButton = new QPushButton( tr( "&Close" ) );
49+
closeButton->setToolTip( tr( "Close this dialog without adding any layer" ) );
50+
buttonBox->addButton( closeButton, QDialogButtonBox::RejectRole );
51+
connect( closeButton, &QPushButton::clicked, this, &QgsAbstractDataSourceWidget::reject );
6152

6253
}
6354

@@ -67,8 +58,3 @@ void QgsAbstractDataSourceWidget::setMapCanvas( const QgsMapCanvas *mapCanvas )
6758
mMapCanvas = mapCanvas;
6859
}
6960

70-
void QgsAbstractDataSourceWidget::okButtonClicked()
71-
{
72-
addButtonClicked();
73-
emit accepted();
74-
}

src/gui/qgsabstractdatasourcewidget.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@ class GUI_EXPORT QgsAbstractDataSourceWidget : public QDialog
6969
*/
7070
virtual void addButtonClicked() { }
7171

72-
/**
73-
* Triggered when the dialog is accepted, call addButtonClicked() and
74-
* emit the accepted() signal
75-
*/
76-
virtual void okButtonClicked();
7772

7873
signals:
7974

src/gui/qgsdatasourcemanagerdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ QgsDataSourceManagerDialog::QgsDataSourceManagerDialog( QgsBrowserModel *browser
6060

6161
// Add provider dialogs
6262
const QList<QgsSourceSelectProvider *> sourceSelectProviders = QgsGui::sourceSelectProviderRegistry()->providers( );
63-
for ( const auto provider : sourceSelectProviders )
63+
for ( const auto &provider : sourceSelectProviders )
6464
{
6565
QgsAbstractDataSourceWidget *dlg = provider->createDataSourceWidget( this );
6666
if ( !dlg )

0 commit comments

Comments
 (0)