Skip to content
Permalink
Browse files
fix updating disabled scalar dataset group for mesh layer
  • Loading branch information
vcloarec authored and nyalldawson committed Jul 6, 2021
1 parent 1807cfe commit 621382e0334bcb3b8b73135ef48bf286b930eed9
Showing with 20 additions and 5 deletions.
  1. +4 −3 src/gui/mesh/qgsmeshlayerproperties.cpp
  2. +16 −2 src/gui/mesh/qgsmeshstaticdatasetwidget.cpp
@@ -214,7 +214,7 @@ void QgsMeshLayerProperties::syncToLayer()
mDatasetGroupTreeWidget->syncToLayer( mMeshLayer );

QgsDebugMsgLevel( QStringLiteral( "populate config tab" ), 4 );
for ( QgsMapLayerConfigWidget *w : mConfigWidgets )
for ( QgsMapLayerConfigWidget *w : std::as_const( mConfigWidgets ) )
w->syncToLayer( mMeshLayer );

QgsDebugMsgLevel( QStringLiteral( "populate rendering tab" ), 4 );
@@ -362,7 +362,7 @@ void QgsMeshLayerProperties::apply()

QgsDebugMsgLevel( QStringLiteral( "processing config tabs" ), 4 );

for ( QgsMapLayerConfigWidget *w : mConfigWidgets )
for ( QgsMapLayerConfigWidget *w : std::as_const( mConfigWidgets ) )
w->apply();

QgsDebugMsgLevel( QStringLiteral( "processing rendering tab" ), 4 );
@@ -410,7 +410,8 @@ void QgsMeshLayerProperties::apply()

// Resync what have to be resync (widget that can be changed by other properties part)
mStaticDatasetWidget->syncToLayer();
mRendererMeshPropertiesWidget->syncToLayer();
for ( QgsMapLayerConfigWidget *w : std::as_const( mConfigWidgets ) )
w->syncToLayer( mMeshLayer );
}

void QgsMeshLayerProperties::changeCrs( const QgsCoordinateReferenceSystem &crs )
@@ -48,8 +48,22 @@ void QgsMeshStaticDatasetWidget::apply()
if ( !mLayer )
return;

mLayer->setStaticScalarDatasetIndex( QgsMeshDatasetIndex( mScalarDatasetGroup, mScalarDatasetComboBox->currentIndex() - 1 ) );
mLayer->setStaticVectorDatasetIndex( QgsMeshDatasetIndex( mVectorDatasetGroup, mVectorDatasetComboBox->currentIndex() - 1 ) );
int scalarIndex;
// if only one item, there is no active dataset group.
// Set to 0 instead of -1 to avoid none dataset (item 0) when the group is reactivate
if ( mScalarDatasetComboBox->count() == 1 )
scalarIndex = 0;
else
scalarIndex = mScalarDatasetComboBox->currentIndex() - 1;
int vectorIndex;
// Same as scalar
if ( mVectorDatasetComboBox->count() == 1 )
vectorIndex = 0;
else
vectorIndex = mVectorDatasetComboBox->currentIndex() - 1;

mLayer->setStaticScalarDatasetIndex( QgsMeshDatasetIndex( mScalarDatasetGroup, scalarIndex ) );
mLayer->setStaticVectorDatasetIndex( QgsMeshDatasetIndex( mVectorDatasetGroup, vectorIndex ) );
}

void QgsMeshStaticDatasetWidget::setScalarDatasetGroup( int index )

0 comments on commit 621382e

Please sign in to comment.