Skip to content

Commit

Permalink
Rearrange buttons in feature source input widget so the "..." buttons
Browse files Browse the repository at this point in the history
stay aligned in processing dialogs
  • Loading branch information
nyalldawson committed Apr 1, 2020
1 parent c98cd8d commit 991877f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/gui/processing/qgsprocessingmaplayercombobox.cpp
Expand Up @@ -50,11 +50,6 @@ QgsProcessingMapLayerComboBox::QgsProcessingMapLayerComboBox( const QgsProcessin
layout->addWidget( mCombo );
layout->setAlignment( mCombo, Qt::AlignTop );

mSelectButton = new QToolButton();
mSelectButton->setText( QString( QChar( 0x2026 ) ) );
mSelectButton->setToolTip( tr( "Select input" ) );
layout->addWidget( mSelectButton );
layout->setAlignment( mSelectButton, Qt::AlignTop );
int iconSize = QgsGuiUtils::scaleIconSize( 24 );
if ( mParameter->type() == QgsProcessingParameterFeatureSource::typeName() && type == QgsProcessingGui::Standard )
{
Expand Down Expand Up @@ -86,15 +81,22 @@ QgsProcessingMapLayerComboBox::QgsProcessingMapLayerComboBox( const QgsProcessin
connect( mSettingsButton, &QToolButton::clicked, this, &QgsProcessingMapLayerComboBox::showSourceOptions );
layout->addWidget( mSettingsButton );
layout->setAlignment( mSettingsButton, Qt::AlignTop );
}

mSelectButton = new QToolButton();
mSelectButton->setText( QString( QChar( 0x2026 ) ) );
mSelectButton->setToolTip( tr( "Select input" ) );
layout->addWidget( mSelectButton );
layout->setAlignment( mSelectButton, Qt::AlignTop );
if ( mParameter->type() == QgsProcessingParameterFeatureSource::typeName() )
{
mFeatureSourceMenu = new QMenu( this );
QAction *selectFromFileAction = new QAction( tr( "Select File…" ), mFeatureSourceMenu );
connect( selectFromFileAction, &QAction::triggered, this, &QgsProcessingMapLayerComboBox::selectFromFile );
mFeatureSourceMenu->addAction( selectFromFileAction );
QAction *browseForLayerAction = new QAction( tr( "Browse for Layer…" ), mFeatureSourceMenu );
connect( browseForLayerAction, &QAction::triggered, this, &QgsProcessingMapLayerComboBox::browseForLayer );
mFeatureSourceMenu->addAction( browseForLayerAction );

mSelectButton->setMenu( mFeatureSourceMenu );
mSelectButton->setPopupMode( QToolButton::InstantPopup );
}
Expand Down

0 comments on commit 991877f

Please sign in to comment.