@@ -38,26 +38,17 @@ const QgsMapCanvas *QgsAbstractDataSourceWidget::mapCanvas() const
38
38
void QgsAbstractDataSourceWidget::setupButtons ( QDialogButtonBox *buttonBox )
39
39
{
40
40
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
-
48
41
mAddButton = new QPushButton ( tr ( " &Add" ) );
49
42
mAddButton ->setToolTip ( tr ( " Add selected layers to map" ) );
50
43
mAddButton ->setEnabled ( false );
51
44
buttonBox->addButton ( mAddButton , QDialogButtonBox::ApplyRole );
52
45
connect ( mAddButton , &QPushButton::clicked, this , &QgsAbstractDataSourceWidget::addButtonClicked );
53
46
connect ( this , &QgsAbstractDataSourceWidget::enableButtons, mAddButton , &QPushButton::setEnabled );
54
47
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 );
61
52
62
53
}
63
54
@@ -67,8 +58,3 @@ void QgsAbstractDataSourceWidget::setMapCanvas( const QgsMapCanvas *mapCanvas )
67
58
mMapCanvas = mapCanvas;
68
59
}
69
60
70
- void QgsAbstractDataSourceWidget::okButtonClicked ()
71
- {
72
- addButtonClicked ();
73
- emit accepted ();
74
- }
0 commit comments