Skip to content

Commit

Permalink
Remove OK button and add CLOSE
Browse files Browse the repository at this point in the history
Yes, it's one more click to quit, but more intuitive UI
  • Loading branch information
elpaso committed Nov 13, 2017
1 parent 1ab20bd commit 79c8f96
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 21 deletions.
5 changes: 0 additions & 5 deletions python/gui/qgsabstractdatasourcewidget.sip
Expand Up @@ -53,11 +53,6 @@ Destructor
being added.
%End

virtual void okButtonClicked();
%Docstring
Triggered when the dialog is accepted, call addButtonClicked() and
emit the accepted() signal
%End

signals:

Expand Down
15 changes: 4 additions & 11 deletions src/gui/qgsabstractdatasourcewidget.cpp
Expand Up @@ -52,12 +52,10 @@ void QgsAbstractDataSourceWidget::setupButtons( QDialogButtonBox *buttonBox )
connect( mAddButton, &QPushButton::clicked, this, &QgsAbstractDataSourceWidget::addButtonClicked );
connect( this, &QgsAbstractDataSourceWidget::enableButtons, mAddButton, &QPushButton::setEnabled );

QPushButton *okButton = new QPushButton( tr( "&Ok" ) );
okButton->setToolTip( tr( "Add selected layers to map and close this dialog" ) );
okButton->setEnabled( false );
buttonBox->addButton( okButton, QDialogButtonBox::AcceptRole );
connect( okButton, &QPushButton::clicked, this, &QgsAbstractDataSourceWidget::okButtonClicked );
connect( this, &QgsAbstractDataSourceWidget::enableButtons, okButton, &QPushButton::setEnabled );
QPushButton *closeButton = new QPushButton( tr( "&Close" ) );
closeButton->setToolTip( tr( "Close this dialog without adding any layer" ) );
buttonBox->addButton( closeButton, QDialogButtonBox::RejectRole );
connect( closeButton, &QPushButton::clicked, this, &QgsAbstractDataSourceWidget::reject );

}

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

void QgsAbstractDataSourceWidget::okButtonClicked()
{
addButtonClicked();
emit accepted();
}
5 changes: 0 additions & 5 deletions src/gui/qgsabstractdatasourcewidget.h
Expand Up @@ -69,11 +69,6 @@ class GUI_EXPORT QgsAbstractDataSourceWidget : public QDialog
*/
virtual void addButtonClicked() { }

/**
* Triggered when the dialog is accepted, call addButtonClicked() and
* emit the accepted() signal
*/
virtual void okButtonClicked();

signals:

Expand Down

0 comments on commit 79c8f96

Please sign in to comment.