Remove OK button and add CLOSE

Yes, it's one more click to quit, but more intuitive UI
This commit is contained in:
Alessandro Pasotti 2017-11-13 11:29:59 +01:00
parent 1ab20bd7e9
commit 79c8f9686d
3 changed files with 4 additions and 21 deletions

View File

@ -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:

View File

@ -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 );
}
@ -67,8 +65,3 @@ void QgsAbstractDataSourceWidget::setMapCanvas( const QgsMapCanvas *mapCanvas )
mMapCanvas = mapCanvas;
}
void QgsAbstractDataSourceWidget::okButtonClicked()
{
addButtonClicked();
emit accepted();
}

View File

@ -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: