Skip to content
Permalink
Browse files

Use standard buttons for unified add layer dialog

Fixes #17728 by setting the standard buttons in the
button box instead of manually adding them by code.

This way the buttons should honor the platform-specific
position and look&feel.
  • Loading branch information
elpaso committed Dec 21, 2017
1 parent 5daf33a commit 8fb147f8029e515d64667c562a96ccd05995217f
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/gui/qgsabstractdatasourcewidget.cpp
@@ -38,16 +38,16 @@ const QgsMapCanvas *QgsAbstractDataSourceWidget::mapCanvas() const
void QgsAbstractDataSourceWidget::setupButtons( QDialogButtonBox *buttonBox )
{

mAddButton = new QPushButton( tr( "&Add" ) );
buttonBox->setStandardButtons( QDialogButtonBox::Apply | QDialogButtonBox::Close | QDialogButtonBox::Help );
mAddButton = buttonBox->button( QDialogButtonBox::Apply );
mAddButton->setText( tr( "&Add" ) );
mAddButton->setToolTip( tr( "Add selected layers to map" ) );
mAddButton->setEnabled( false );
buttonBox->addButton( mAddButton, QDialogButtonBox::ApplyRole );
connect( mAddButton, &QPushButton::clicked, this, &QgsAbstractDataSourceWidget::addButtonClicked );
connect( this, &QgsAbstractDataSourceWidget::enableButtons, mAddButton, &QPushButton::setEnabled );

QPushButton *closeButton = new QPushButton( tr( "&Close" ) );
QPushButton *closeButton = buttonBox->button( QDialogButtonBox::Close );
closeButton->setToolTip( tr( "Close this dialog without adding any layer" ) );
buttonBox->addButton( closeButton, QDialogButtonBox::RejectRole );
connect( closeButton, &QPushButton::clicked, this, &QgsAbstractDataSourceWidget::reject );

}

0 comments on commit 8fb147f

Please sign in to comment.
You can’t perform that action at this time.