Skip to content

Commit

Permalink
Fix impossible to activate draw effects on settings in font buttons
Browse files Browse the repository at this point in the history
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!

(cherry picked from commit c851c0f)
  • Loading branch information
nyalldawson committed Dec 21, 2020
1 parent 4ff5558 commit ccd5c28
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/gui/qgstextformatwidget.cpp
Expand Up @@ -1038,7 +1038,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 );
Expand All @@ -1052,7 +1052,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 );
Expand Down Expand Up @@ -1085,7 +1085,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 );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/vector/qgsdiagramproperties.cpp
Expand Up @@ -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 );
Expand Down

0 comments on commit ccd5c28

Please sign in to comment.