Skip to content
Permalink
Browse files

Fix impossible to activate draw effects on settings in font buttons

If we ignore the enabled state when testing whether a paint effect
should be saved, then we get stuck in a loop where first enabling
the effect still reports the stack as a default stack so the widget
immediately unchecks itself and it's impossible for users to actually
modify the stack and make it definitely non-default!
  • Loading branch information
nyalldawson committed Dec 21, 2020
1 parent b331c79 commit c851c0ff693814acc9049895ab4b12f962641d65
Showing with 4 additions and 4 deletions.
  1. +3 −3 src/gui/qgstextformatwidget.cpp
  2. +1 −1 src/gui/vector/qgsdiagramproperties.cpp
@@ -1039,7 +1039,7 @@ QgsTextFormat QgsTextFormatWidget::format( bool includeDataDefinedProperties ) c
buffer.setJoinStyle( mBufferJoinStyleComboBox->penJoinStyle() );
buffer.setFillBufferInterior( mBufferTranspFillChbx->isChecked() );
buffer.setBlendMode( comboBufferBlendMode->blendMode() );
if ( mBufferEffect && !QgsPaintEffectRegistry::isDefaultStack( mBufferEffect.get() ) )
if ( mBufferEffect && ( !QgsPaintEffectRegistry::isDefaultStack( mBufferEffect.get() ) || mBufferEffect->enabled() ) )
buffer.setPaintEffect( mBufferEffect->clone() );
else
buffer.setPaintEffect( nullptr );
@@ -1053,7 +1053,7 @@ QgsTextFormat QgsTextFormatWidget::format( bool includeDataDefinedProperties ) c
mask.setSizeUnit( mMaskBufferUnitWidget->unit() );
mask.setSizeMapUnitScale( mMaskBufferUnitWidget->getMapUnitScale() );
mask.setJoinStyle( mMaskJoinStyleComboBox->penJoinStyle() );
if ( mMaskEffect && !QgsPaintEffectRegistry::isDefaultStack( mMaskEffect.get() ) )
if ( mMaskEffect && ( !QgsPaintEffectRegistry::isDefaultStack( mMaskEffect.get() ) || mMaskEffect->enabled() ) )
mask.setPaintEffect( mMaskEffect->clone() );
else
mask.setPaintEffect( nullptr );
@@ -1086,7 +1086,7 @@ QgsTextFormat QgsTextFormatWidget::format( bool includeDataDefinedProperties ) c
background.setJoinStyle( mShapePenStyleCmbBx->penJoinStyle() );
background.setOpacity( mBackgroundOpacityWidget->opacity() );
background.setBlendMode( mShapeBlendCmbBx->blendMode() );
if ( mBackgroundEffect && !QgsPaintEffectRegistry::isDefaultStack( mBackgroundEffect.get() ) )
if ( mBackgroundEffect && ( !QgsPaintEffectRegistry::isDefaultStack( mBackgroundEffect.get() ) || mBackgroundEffect->enabled() ) )
background.setPaintEffect( mBackgroundEffect->clone() );
else
background.setPaintEffect( nullptr );
@@ -882,7 +882,7 @@ void QgsDiagramProperties::apply()
ds.setSpacingUnit( mBarSpacingUnitComboBox->unit() );
ds.setSpacingMapUnitScale( mBarSpacingUnitComboBox->getMapUnitScale() );

if ( mPaintEffect && !QgsPaintEffectRegistry::isDefaultStack( mPaintEffect.get() ) )
if ( mPaintEffect && ( !QgsPaintEffectRegistry::isDefaultStack( mPaintEffect.get() ) || mPaintEffect->enabled() ) )
ds.setPaintEffect( mPaintEffect->clone() );
else
ds.setPaintEffect( nullptr );

0 comments on commit c851c0f

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