Skip to content

Commit 79c8f96

Browse files
committedNov 13, 2017
Remove OK button and add CLOSE
Yes, it's one more click to quit, but more intuitive UI
1 parent 1ab20bd commit 79c8f96

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
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 & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,10 @@ void QgsAbstractDataSourceWidget::setupButtons( QDialogButtonBox *buttonBox )
5252
connect( mAddButton, &QPushButton::clicked, this, &QgsAbstractDataSourceWidget::addButtonClicked );
5353
connect( this, &QgsAbstractDataSourceWidget::enableButtons, mAddButton, &QPushButton::setEnabled );
5454

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 );
55+
QPushButton *closeButton = new QPushButton( tr( "&Close" ) );
56+
closeButton->setToolTip( tr( "Close this dialog without adding any layer" ) );
57+
buttonBox->addButton( closeButton, QDialogButtonBox::RejectRole );
58+
connect( closeButton, &QPushButton::clicked, this, &QgsAbstractDataSourceWidget::reject );
6159

6260
}
6361

@@ -67,8 +65,3 @@ void QgsAbstractDataSourceWidget::setMapCanvas( const QgsMapCanvas *mapCanvas )
6765
mMapCanvas = mapCanvas;
6866
}
6967

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

0 commit comments

Comments
 (0)
Please sign in to comment.