Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 8fb147f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/gui/qgsabstractdatasourcewidget.cpp
Expand Up @@ -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 );

}
Expand Down

0 comments on commit 8fb147f

Please sign in to comment.