Skip to content

Commit

Permalink
Only list layers with styling options in styling panel
Browse files Browse the repository at this point in the history
Otherwise it's very easy to switch to a layer without styling options which will hide the combobox and require the user to move over to the legend to select another layer to work on.
  • Loading branch information
m-kuhn authored and nyalldawson committed Aug 9, 2020
1 parent 454cc32 commit 05b9482
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/qgslayerstylingwidget.cpp
Expand Up @@ -101,6 +101,12 @@ QgsLayerStylingWidget::QgsLayerStylingWidget( QgsMapCanvas *canvas, QgsMessageBa
connect( mLayerCombo, &QgsMapLayerComboBox::layerChanged, this, &QgsLayerStylingWidget::setLayer );
connect( mLiveApplyCheck, &QAbstractButton::toggled, this, &QgsLayerStylingWidget::liveApplyToggled );

mLayerCombo->setFilters( QgsMapLayerProxyModel::Filter::HasGeometry
| QgsMapLayerProxyModel::Filter::RasterLayer
| QgsMapLayerProxyModel::Filter::PluginLayer
| QgsMapLayerProxyModel::Filter::MeshLayer
| QgsMapLayerProxyModel::Filter::VectorTileLayer );

mStackedWidget->setCurrentIndex( 0 );
}

Expand Down Expand Up @@ -246,8 +252,7 @@ void QgsLayerStylingWidget::setLayer( QgsMapLayer *layer )
break;
}

const auto constMPageFactories = mPageFactories;
for ( QgsMapLayerConfigWidgetFactory *factory : constMPageFactories )
for ( QgsMapLayerConfigWidgetFactory *factory : qgis::as_const( mPageFactories ) )
{
if ( factory->supportsStyleDock() && factory->supportsLayer( layer ) )
{
Expand Down

0 comments on commit 05b9482

Please sign in to comment.