Skip to content
Permalink
Browse files

[labeling] Fix handling of data-defined buffers (both UI/UX and rende…

…ring behavior)
  • Loading branch information
nirvn committed Mar 25, 2021
1 parent 9b07d95 commit 1a7fe6ae5557b640cf0fea704b38c1918551994a
@@ -186,6 +186,7 @@ void QgsLabelPropertyDialog::init( const QString &layerId, const QString &provid
mYCoordSpinBox->clear();

mShowLabelChkbx->setChecked( true );
mBufferDrawChkbx->setChecked( buffer.enabled() );
mFontColorButton->setColor( format.color() );
mBufferColorButton->setColor( buffer.color() );
mMinScaleWidget->setScale( layerSettings.minimumScale );
@@ -3051,7 +3051,6 @@ void QgsPalLayerSettings::parseTextBuffer( QgsRenderContext &context )
}
else if ( mDataDefinedProperties.isActive( QgsPalLayerSettings::BufferDraw ) && exprVal.isNull() )
{
drawBuffer = false;
dataDefinedValues.insert( QgsPalLayerSettings::BufferDraw, QVariant( drawBuffer ) );
}

@@ -32,6 +32,7 @@
#include "callouts/qgscalloutwidget.h"
#include "qgslabelobstaclesettingswidget.h"
#include "qgslabellineanchorwidget.h"

#include <mutex>

#include <QButtonGroup>
@@ -244,6 +245,7 @@ QgsLabelingGui::QgsLabelingGui( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas,

// connections for groupboxes with separate activation checkboxes (that need to honor data defined setting)
connect( mBufferDrawChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
connect( mBufferDrawDDBtn, &QgsPropertyOverrideButton::changed, this, &QgsLabelingGui::updateUi );
connect( mEnableMaskChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
connect( mShapeDrawChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
connect( mCalloutsDrawCheckBox, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
@@ -627,11 +629,7 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings()

void QgsLabelingGui::syncDefinedCheckboxFrame( QgsPropertyOverrideButton *ddBtn, QCheckBox *chkBx, QFrame *f )
{
if ( ddBtn->isActive() && !chkBx->isChecked() )
{
chkBx->setChecked( true );
}
f->setEnabled( chkBx->isChecked() );
f->setEnabled( chkBx->isChecked() || ddBtn->isActive() );
}

bool QgsLabelingGui::eventFilter( QObject *object, QEvent *event )
@@ -707,7 +707,6 @@ void QgsTextFormatWidget::populateDataDefinedButtons()

// text buffer
registerDataDefinedButton( mBufferDrawDDBtn, QgsPalLayerSettings::BufferDraw );
mBufferDrawDDBtn->registerCheckedWidget( mBufferDrawChkBx );
registerDataDefinedButton( mBufferSizeDDBtn, QgsPalLayerSettings::BufferSize );
registerDataDefinedButton( mBufferUnitsDDBtn, QgsPalLayerSettings::BufferUnit );
registerDataDefinedButton( mBufferColorDDBtn, QgsPalLayerSettings::BufferColor );

0 comments on commit 1a7fe6a

Please sign in to comment.