29#include "moc_qgscalloutwidget.cpp"
33 if (
auto *lExpressionContext = mContext.expressionContext() )
34 return *lExpressionContext;
39 expContext << symbolScope;
42 const auto constAdditionalExpressionContextScopes = mContext.additionalExpressionContextScopes();
59 const auto unitSelectionWidgets = findChildren<QgsUnitSelectionWidget *>();
62 unitWidget->setMapCanvas( mContext.mapCanvas() );
64 const auto symbolButtonWidgets = findChildren<QgsSymbolButton *>();
67 symbolWidget->setMapCanvas( mContext.mapCanvas() );
68 symbolWidget->setMessageBar( mContext.messageBar() );
86void QgsCalloutWidget::createAuxiliaryField()
103 QgsPropertyOverrideButton *button = qobject_cast<QgsPropertyOverrideButton *>( sender() );
108 if ( !
vectorLayer->auxiliaryLayer()->exists( def ) )
110 vectorLayer->auxiliaryLayer()->addAuxiliaryField( def );
116 property.setActive(
true );
125void QgsCalloutWidget::updateDataDefinedProperty()
127 QgsPropertyOverrideButton *button = qobject_cast<QgsPropertyOverrideButton *>( sender() );
139QgsSimpleLineCalloutWidget::QgsSimpleLineCalloutWidget(
QgsMapLayer *vl, QWidget *parent )
146 mCalloutLineStyleButton->setDialogTitle( tr(
"Callout Symbol" ) );
147 mCalloutLineStyleButton->registerExpressionContextGenerator(
this );
149 mCalloutLineStyleButton->setLayer( qobject_cast<QgsVectorLayer *>( vl ) );
150 mMinCalloutWidthUnitWidget->setUnits(
153 mOffsetFromAnchorUnitWidget->setUnits(
156 mOffsetFromLabelUnitWidget->setUnits(
161 connect( mMinCalloutLengthSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineCalloutWidget::minimumLengthChanged );
164 connect( mOffsetFromAnchorSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineCalloutWidget::offsetFromAnchorChanged );
166 connect( mOffsetFromLabelSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineCalloutWidget::offsetFromLabelChanged );
168 connect( mDrawToAllPartsCheck, &QCheckBox::toggled,
this, &QgsSimpleLineCalloutWidget::drawToAllPartsToggled );
175 connect( mAnchorPointComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineCalloutWidget::mAnchorPointComboBox_currentIndexChanged );
187 connect( mLabelAnchorPointComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineCalloutWidget::mLabelAnchorPointComboBox_currentIndexChanged );
189 connect( mCalloutLineStyleButton, &
QgsSymbolButton::changed,
this, &QgsSimpleLineCalloutWidget::lineSymbolChanged );
191 connect( mCalloutBlendComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineCalloutWidget::mCalloutBlendComboBox_currentIndexChanged );
193 mPlacementDDGroupBox->setVisible( qobject_cast<QgsVectorLayer *>( vl ) );
196void QgsSimpleLineCalloutWidget::setCallout(
const QgsCallout *callout )
205 mMinCalloutWidthUnitWidget->blockSignals(
true );
206 mMinCalloutWidthUnitWidget->setUnit( mCallout->minimumLengthUnit() );
207 mMinCalloutWidthUnitWidget->setMapUnitScale( mCallout->minimumLengthMapUnitScale() );
208 mMinCalloutWidthUnitWidget->blockSignals(
false );
210 whileBlocking( mMinCalloutLengthSpin )->setValue( mCallout->minimumLength() );
212 mOffsetFromAnchorUnitWidget->blockSignals(
true );
213 mOffsetFromAnchorUnitWidget->setUnit( mCallout->offsetFromAnchorUnit() );
214 mOffsetFromAnchorUnitWidget->setMapUnitScale( mCallout->offsetFromAnchorMapUnitScale() );
215 mOffsetFromAnchorUnitWidget->blockSignals(
false );
216 mOffsetFromLabelUnitWidget->blockSignals(
true );
217 mOffsetFromLabelUnitWidget->setUnit( mCallout->offsetFromLabelUnit() );
218 mOffsetFromLabelUnitWidget->setMapUnitScale( mCallout->offsetFromLabelMapUnitScale() );
219 mOffsetFromLabelUnitWidget->blockSignals(
false );
220 whileBlocking( mOffsetFromAnchorSpin )->setValue( mCallout->offsetFromAnchor() );
221 whileBlocking( mOffsetFromLabelSpin )->setValue( mCallout->offsetFromLabel() );
223 whileBlocking( mCalloutLineStyleButton )->setSymbol( mCallout->lineSymbol()->clone() );
225 whileBlocking( mDrawToAllPartsCheck )->setChecked( mCallout->drawCalloutToAllParts() );
227 whileBlocking( mAnchorPointComboBox )->setCurrentIndex( mAnchorPointComboBox->findData(
static_cast<int>( callout->
anchorPoint() ) ) );
228 whileBlocking( mLabelAnchorPointComboBox )->setCurrentIndex( mLabelAnchorPointComboBox->findData(
static_cast<int>( callout->
labelAnchorPoint() ) ) );
230 whileBlocking( mCalloutBlendComboBox )->setBlendMode( mCallout->blendMode() );
249 mAnchorPointLbl->setEnabled( isPolygon );
250 mAnchorPointLbl->setVisible( isPolygon );
251 mAnchorPointComboBox->setEnabled( isPolygon );
252 mAnchorPointComboBox->setVisible( isPolygon );
253 mAnchorPointDDBtn->setEnabled( isPolygon );
254 mAnchorPointDDBtn->setVisible( isPolygon );
257QgsCallout *QgsSimpleLineCalloutWidget::callout()
259 return mCallout.get();
262void QgsSimpleLineCalloutWidget::minimumLengthChanged()
264 mCallout->setMinimumLength( mMinCalloutLengthSpin->value() );
268void QgsSimpleLineCalloutWidget::minimumLengthUnitWidgetChanged()
270 mCallout->setMinimumLengthUnit( mMinCalloutWidthUnitWidget->unit() );
271 mCallout->setMinimumLengthMapUnitScale( mMinCalloutWidthUnitWidget->getMapUnitScale() );
275void QgsSimpleLineCalloutWidget::offsetFromAnchorUnitWidgetChanged()
277 mCallout->setOffsetFromAnchorUnit( mOffsetFromAnchorUnitWidget->unit() );
278 mCallout->setOffsetFromAnchorMapUnitScale( mOffsetFromAnchorUnitWidget->getMapUnitScale() );
282void QgsSimpleLineCalloutWidget::offsetFromAnchorChanged()
284 mCallout->setOffsetFromAnchor( mOffsetFromAnchorSpin->value() );
288void QgsSimpleLineCalloutWidget::offsetFromLabelUnitWidgetChanged()
290 mCallout->setOffsetFromLabelUnit( mOffsetFromLabelUnitWidget->unit() );
291 mCallout->setOffsetFromLabelMapUnitScale( mOffsetFromLabelUnitWidget->getMapUnitScale() );
295void QgsSimpleLineCalloutWidget::offsetFromLabelChanged()
297 mCallout->setOffsetFromLabel( mOffsetFromLabelSpin->value() );
301void QgsSimpleLineCalloutWidget::lineSymbolChanged()
303 mCallout->setLineSymbol( mCalloutLineStyleButton->clonedSymbol<
QgsLineSymbol>() );
307void QgsSimpleLineCalloutWidget::mAnchorPointComboBox_currentIndexChanged(
int index )
309 mCallout->setAnchorPoint(
static_cast<QgsCallout::AnchorPoint>( mAnchorPointComboBox->itemData( index ).toInt() ) );
313void QgsSimpleLineCalloutWidget::mLabelAnchorPointComboBox_currentIndexChanged(
int index )
319void QgsSimpleLineCalloutWidget::mCalloutBlendComboBox_currentIndexChanged(
int )
321 mCallout->setBlendMode( mCalloutBlendComboBox->blendMode() );
325void QgsSimpleLineCalloutWidget::drawToAllPartsToggled(
bool active )
327 mCallout->setDrawCalloutToAllParts( active );
336QgsManhattanLineCalloutWidget::QgsManhattanLineCalloutWidget(
QgsMapLayer *vl, QWidget *parent )
337 : QgsSimpleLineCalloutWidget( vl, parent )
345QgsCurvedLineCalloutWidget::QgsCurvedLineCalloutWidget(
QgsMapLayer *vl, QWidget *parent )
352 mCalloutLineStyleButton->setDialogTitle( tr(
"Callout Symbol" ) );
353 mCalloutLineStyleButton->registerExpressionContextGenerator(
this );
355 mCalloutLineStyleButton->setLayer( qobject_cast<QgsVectorLayer *>( vl ) );
356 mMinCalloutWidthUnitWidget->setUnits(
359 mOffsetFromAnchorUnitWidget->setUnits(
362 mOffsetFromLabelUnitWidget->setUnits(
367 connect( mMinCalloutLengthSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsCurvedLineCalloutWidget::minimumLengthChanged );
370 connect( mOffsetFromAnchorSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsCurvedLineCalloutWidget::offsetFromAnchorChanged );
372 connect( mOffsetFromLabelSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsCurvedLineCalloutWidget::offsetFromLabelChanged );
374 connect( mDrawToAllPartsCheck, &QCheckBox::toggled,
this, &QgsCurvedLineCalloutWidget::drawToAllPartsToggled );
379 connect( mOrientationComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this](
int index ) {
389 connect( mAnchorPointComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsCurvedLineCalloutWidget::mAnchorPointComboBox_currentIndexChanged );
401 connect( mLabelAnchorPointComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsCurvedLineCalloutWidget::mLabelAnchorPointComboBox_currentIndexChanged );
403 connect( mCalloutLineStyleButton, &
QgsSymbolButton::changed,
this, &QgsCurvedLineCalloutWidget::lineSymbolChanged );
405 connect( mCurvatureSlider, &QSlider::valueChanged,
this, [
this](
int value ) { mCurvatureSpinBox->setValue( value / 10.0 ); } );
406 connect( mCurvatureSpinBox,
static_cast<void ( QgsDoubleSpinBox::* )(
double )
>( &QgsDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
409 connect( mCurvatureSpinBox,
static_cast<void ( QgsDoubleSpinBox::* )(
double )
>( &QgsDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
410 mCallout->setCurvature( value / 100.0 );
414 connect( mCalloutBlendComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsCurvedLineCalloutWidget::mCalloutBlendComboBox_currentIndexChanged );
416 mPlacementDDGroupBox->setVisible( qobject_cast<QgsVectorLayer *>( vl ) );
419void QgsCurvedLineCalloutWidget::setCallout(
const QgsCallout *callout )
428 mMinCalloutWidthUnitWidget->blockSignals(
true );
429 mMinCalloutWidthUnitWidget->setUnit( mCallout->minimumLengthUnit() );
430 mMinCalloutWidthUnitWidget->setMapUnitScale( mCallout->minimumLengthMapUnitScale() );
431 mMinCalloutWidthUnitWidget->blockSignals(
false );
433 whileBlocking( mMinCalloutLengthSpin )->setValue( mCallout->minimumLength() );
435 mOffsetFromAnchorUnitWidget->blockSignals(
true );
436 mOffsetFromAnchorUnitWidget->setUnit( mCallout->offsetFromAnchorUnit() );
437 mOffsetFromAnchorUnitWidget->setMapUnitScale( mCallout->offsetFromAnchorMapUnitScale() );
438 mOffsetFromAnchorUnitWidget->blockSignals(
false );
439 mOffsetFromLabelUnitWidget->blockSignals(
true );
440 mOffsetFromLabelUnitWidget->setUnit( mCallout->offsetFromLabelUnit() );
441 mOffsetFromLabelUnitWidget->setMapUnitScale( mCallout->offsetFromLabelMapUnitScale() );
442 mOffsetFromLabelUnitWidget->blockSignals(
false );
443 whileBlocking( mOffsetFromAnchorSpin )->setValue( mCallout->offsetFromAnchor() );
444 whileBlocking( mOffsetFromLabelSpin )->setValue( mCallout->offsetFromLabel() );
446 whileBlocking( mCalloutLineStyleButton )->setSymbol( mCallout->lineSymbol()->clone() );
448 whileBlocking( mDrawToAllPartsCheck )->setChecked( mCallout->drawCalloutToAllParts() );
450 whileBlocking( mOrientationComboBox )->setCurrentIndex( mOrientationComboBox->findData(
static_cast<int>( mCallout->orientation() ) ) );
452 whileBlocking( mAnchorPointComboBox )->setCurrentIndex( mAnchorPointComboBox->findData(
static_cast<int>( callout->
anchorPoint() ) ) );
453 whileBlocking( mLabelAnchorPointComboBox )->setCurrentIndex( mLabelAnchorPointComboBox->findData(
static_cast<int>( callout->
labelAnchorPoint() ) ) );
455 whileBlocking( mCalloutBlendComboBox )->setBlendMode( mCallout->blendMode() );
457 whileBlocking( mCurvatureSpinBox )->setValue( mCallout->curvature() * 100.0 );
458 whileBlocking( mCurvatureSlider )->setValue( mCallout->curvature() * 1000.0 );
479 mAnchorPointLbl->setEnabled( isPolygon );
480 mAnchorPointLbl->setVisible( isPolygon );
481 mAnchorPointComboBox->setEnabled( isPolygon );
482 mAnchorPointComboBox->setVisible( isPolygon );
483 mAnchorPointDDBtn->setEnabled( isPolygon );
484 mAnchorPointDDBtn->setVisible( isPolygon );
487QgsCallout *QgsCurvedLineCalloutWidget::callout()
489 return mCallout.get();
492void QgsCurvedLineCalloutWidget::minimumLengthChanged()
494 mCallout->setMinimumLength( mMinCalloutLengthSpin->value() );
498void QgsCurvedLineCalloutWidget::minimumLengthUnitWidgetChanged()
500 mCallout->setMinimumLengthUnit( mMinCalloutWidthUnitWidget->unit() );
501 mCallout->setMinimumLengthMapUnitScale( mMinCalloutWidthUnitWidget->getMapUnitScale() );
505void QgsCurvedLineCalloutWidget::offsetFromAnchorUnitWidgetChanged()
507 mCallout->setOffsetFromAnchorUnit( mOffsetFromAnchorUnitWidget->unit() );
508 mCallout->setOffsetFromAnchorMapUnitScale( mOffsetFromAnchorUnitWidget->getMapUnitScale() );
512void QgsCurvedLineCalloutWidget::offsetFromAnchorChanged()
514 mCallout->setOffsetFromAnchor( mOffsetFromAnchorSpin->value() );
518void QgsCurvedLineCalloutWidget::offsetFromLabelUnitWidgetChanged()
520 mCallout->setOffsetFromLabelUnit( mOffsetFromLabelUnitWidget->unit() );
521 mCallout->setOffsetFromLabelMapUnitScale( mOffsetFromLabelUnitWidget->getMapUnitScale() );
525void QgsCurvedLineCalloutWidget::offsetFromLabelChanged()
527 mCallout->setOffsetFromLabel( mOffsetFromLabelSpin->value() );
531void QgsCurvedLineCalloutWidget::lineSymbolChanged()
533 mCallout->setLineSymbol( mCalloutLineStyleButton->clonedSymbol<
QgsLineSymbol>() );
537void QgsCurvedLineCalloutWidget::mAnchorPointComboBox_currentIndexChanged(
int index )
539 mCallout->setAnchorPoint(
static_cast<QgsCallout::AnchorPoint>( mAnchorPointComboBox->itemData( index ).toInt() ) );
543void QgsCurvedLineCalloutWidget::mLabelAnchorPointComboBox_currentIndexChanged(
int index )
549void QgsCurvedLineCalloutWidget::mCalloutBlendComboBox_currentIndexChanged(
int )
551 mCallout->setBlendMode( mCalloutBlendComboBox->blendMode() );
555void QgsCurvedLineCalloutWidget::drawToAllPartsToggled(
bool active )
557 mCallout->setDrawCalloutToAllParts( active );
566QgsBalloonCalloutWidget::QgsBalloonCalloutWidget(
QgsMapLayer *vl, QWidget *parent )
573 mCalloutFillStyleButton->setDialogTitle( tr(
"Balloon Symbol" ) );
574 mCalloutFillStyleButton->registerExpressionContextGenerator(
this );
577 mMarkerSymbolButton->setDialogTitle( tr(
"Marker Symbol" ) );
578 mMarkerSymbolButton->registerExpressionContextGenerator(
this );
579 mMarkerSymbolButton->setShowNull(
true );
580 mMarkerSymbolButton->setToNull();
582 mCalloutFillStyleButton->setLayer( qobject_cast<QgsVectorLayer *>( vl ) );
583 mMarkerSymbolButton->setLayer( qobject_cast<QgsVectorLayer *>( vl ) );
584 mOffsetFromAnchorUnitWidget->setUnits(
587 mMarginUnitWidget->setUnits(
590 mWedgeWidthUnitWidget->setUnits(
593 mCornerRadiusUnitWidget->setUnits(
597 mSpinBottomMargin->setClearValue( 0 );
598 mSpinTopMargin->setClearValue( 0 );
599 mSpinRightMargin->setClearValue( 0 );
600 mSpinLeftMargin->setClearValue( 0 );
601 mWedgeWidthSpin->setClearValue( 2.64 );
602 mCornerRadiusSpin->setClearValue( 0.0 );
605 connect( mOffsetFromAnchorSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsBalloonCalloutWidget::offsetFromAnchorChanged );
612 connect( mAnchorPointComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsBalloonCalloutWidget::mAnchorPointComboBox_currentIndexChanged );
617 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
618 QgsMargins margins = mCallout->margins();
620 mCallout->setMargins( margins );
623 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
624 QgsMargins margins = mCallout->margins();
626 mCallout->setMargins( margins );
629 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
630 QgsMargins margins = mCallout->margins();
632 mCallout->setMargins( margins );
635 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
636 QgsMargins margins = mCallout->margins();
638 mCallout->setMargins( margins );
642 mCallout->setMarginsUnit( mMarginUnitWidget->unit() );
647 mCallout->setWedgeWidthUnit( mWedgeWidthUnitWidget->unit() );
648 mCallout->setWedgeWidthMapUnitScale( mWedgeWidthUnitWidget->getMapUnitScale() );
651 connect( mWedgeWidthSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
652 mCallout->setWedgeWidth( value );
657 mCallout->setCornerRadiusUnit( mCornerRadiusUnitWidget->unit() );
658 mCallout->setCornerRadiusMapUnitScale( mCornerRadiusUnitWidget->getMapUnitScale() );
661 connect( mCornerRadiusSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
662 mCallout->setCornerRadius( value );
666 connect( mCalloutBlendComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsBalloonCalloutWidget::mCalloutBlendComboBox_currentIndexChanged );
668 mPlacementDDGroupBox->setVisible( qobject_cast<QgsVectorLayer *>( vl ) );
671void QgsBalloonCalloutWidget::setCallout(
const QgsCallout *callout )
680 mOffsetFromAnchorUnitWidget->blockSignals(
true );
681 mOffsetFromAnchorUnitWidget->setUnit( mCallout->offsetFromAnchorUnit() );
682 mOffsetFromAnchorUnitWidget->setMapUnitScale( mCallout->offsetFromAnchorMapUnitScale() );
683 mOffsetFromAnchorUnitWidget->blockSignals(
false );
684 whileBlocking( mOffsetFromAnchorSpin )->setValue( mCallout->offsetFromAnchor() );
686 whileBlocking( mSpinBottomMargin )->setValue( mCallout->margins().bottom() );
687 whileBlocking( mSpinTopMargin )->setValue( mCallout->margins().top() );
688 whileBlocking( mSpinLeftMargin )->setValue( mCallout->margins().left() );
689 whileBlocking( mSpinRightMargin )->setValue( mCallout->margins().right() );
690 whileBlocking( mMarginUnitWidget )->setUnit( mCallout->marginsUnit() );
692 mWedgeWidthUnitWidget->blockSignals(
true );
693 mWedgeWidthUnitWidget->setUnit( mCallout->wedgeWidthUnit() );
694 mWedgeWidthUnitWidget->setMapUnitScale( mCallout->wedgeWidthMapUnitScale() );
695 mWedgeWidthUnitWidget->blockSignals(
false );
696 whileBlocking( mWedgeWidthSpin )->setValue( mCallout->wedgeWidth() );
698 mCornerRadiusUnitWidget->blockSignals(
true );
699 mCornerRadiusUnitWidget->setUnit( mCallout->cornerRadiusUnit() );
700 mCornerRadiusUnitWidget->setMapUnitScale( mCallout->cornerRadiusMapUnitScale() );
701 mCornerRadiusUnitWidget->blockSignals(
false );
702 whileBlocking( mCornerRadiusSpin )->setValue( mCallout->cornerRadius() );
704 whileBlocking( mCalloutFillStyleButton )->setSymbol( mCallout->fillSymbol()->clone() );
706 whileBlocking( mMarkerSymbolButton )->setSymbol( marker->clone() );
710 whileBlocking( mAnchorPointComboBox )->setCurrentIndex( mAnchorPointComboBox->findData(
static_cast<int>( callout->
anchorPoint() ) ) );
712 whileBlocking( mCalloutBlendComboBox )->setBlendMode( mCallout->blendMode() );
728 mAnchorPointLbl->setEnabled( isPolygon );
729 mAnchorPointLbl->setVisible( isPolygon );
730 mAnchorPointComboBox->setEnabled( isPolygon );
731 mAnchorPointComboBox->setVisible( isPolygon );
732 mAnchorPointDDBtn->setEnabled( isPolygon );
733 mAnchorPointDDBtn->setVisible( isPolygon );
738 return mCallout.get();
741void QgsBalloonCalloutWidget::offsetFromAnchorUnitWidgetChanged()
743 mCallout->setOffsetFromAnchorUnit( mOffsetFromAnchorUnitWidget->unit() );
744 mCallout->setOffsetFromAnchorMapUnitScale( mOffsetFromAnchorUnitWidget->getMapUnitScale() );
748void QgsBalloonCalloutWidget::offsetFromAnchorChanged()
750 mCallout->setOffsetFromAnchor( mOffsetFromAnchorSpin->value() );
754void QgsBalloonCalloutWidget::fillSymbolChanged()
756 mCallout->setFillSymbol( mCalloutFillStyleButton->clonedSymbol<
QgsFillSymbol>() );
760void QgsBalloonCalloutWidget::markerSymbolChanged()
762 mCallout->setMarkerSymbol( mMarkerSymbolButton->isNull() ?
nullptr : mMarkerSymbolButton->clonedSymbol<
QgsMarkerSymbol>() );
766void QgsBalloonCalloutWidget::mAnchorPointComboBox_currentIndexChanged(
int index )
768 mCallout->setAnchorPoint(
static_cast<QgsCallout::AnchorPoint>( mAnchorPointComboBox->itemData( index ).toInt() ) );
772void QgsBalloonCalloutWidget::mCalloutBlendComboBox_currentIndexChanged(
int )
774 mCallout->setBlendMode( mCalloutBlendComboBox->blendMode() );
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
@ Millimeters
Millimeters.
@ Points
Points (e.g., for font sizes).
@ MetersInMapUnits
Meters value as Map units.
static QString nameFromProperty(const QgsPropertyDefinition &def, bool joined=false)
Returns the name of the auxiliary field for a property definition.
A cartoon talking bubble callout style.
Abstract base class for callout renderers.
virtual QgsCallout * clone() const =0
Duplicates a callout by creating a deep copy of the callout.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the callout's property collection, used for data defined overrides.
static QgsPropertiesDefinition propertyDefinitions()
Returns the definitions for data defined properties available for use in callouts.
AnchorPoint anchorPoint() const
Returns the feature's anchor point position.
LabelAnchorPoint labelAnchorPoint() const
Returns the label's anchor point position.
AnchorPoint
Feature's anchor point position.
@ PointOnExterior
A point on the surface's outline closest to the label is used as anchor for polygon geometries.
@ Centroid
The surface's centroid is used as anchor for polygon geometries.
@ PointOnSurface
A point guaranteed to be on the surface is used as anchor for polygon geometries.
@ PoleOfInaccessibility
The surface's pole of inaccessibility used as anchor for polygon geometries.
LabelAnchorPoint
Label's anchor point position.
@ LabelPointOnExterior
The point on the label's boundary closest to the feature.
@ LabelBottomLeft
Bottom left corner of the label's boundary.
@ LabelBottomMiddle
Bottom middle of the label's boundary.
@ LabelMiddleLeft
Middle left of the label's boundary.
@ LabelBottomRight
Bottom right corner of the label's boundary.
@ LabelMiddleRight
Middle right of the label's boundary.
@ LabelTopMiddle
Top middle of the label's boundary.
@ LabelTopLeft
Top left corner of the label's boundary.
@ LabelCentroid
The labe's centroid.
@ LabelTopRight
Top right corner of the label's boundary.
Property
Data definable properties.
@ MinimumCalloutLength
Minimum length of callouts.
@ LabelAnchorPointPosition
Label's anchor point position.
@ CornerRadius
Balloon callout corner radius.
@ OffsetFromAnchor
Distance to offset lines from anchor points.
@ OffsetFromLabel
Distance to offset lines from label area.
@ DestinationX
X-coordinate of callout destination (feature anchor).
@ DestinationY
Y-coordinate of callout destination (feature anchor).
@ WedgeWidth
Balloon callout wedge width.
@ AnchorPointPosition
Feature's anchor point position.
@ OriginX
X-coordinate of callout origin (label anchor).
@ OriginY
Y-coordinate of callout origin (label anchor).
@ Curvature
Curvature of curved line callouts.
@ BlendMode
Callout blend mode.
@ Orientation
Orientation of curved line callouts.
@ Margins
Margin from text.
@ DrawCalloutToAllParts
Whether callout lines should be drawn to all feature parts.
Draws curved lines as callouts.
Orientation
Curve orientation.
@ Clockwise
Curve lines in a clockwise direction.
@ CounterClockwise
Curve lines in a counter-clockwise direction.
@ Automatic
Automatically choose most cartographically pleasing orientation based on label and callout arrangemen...
Single scope for storing variables and functions for use within a QgsExpressionContext.
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
static QgsExpressionContextScope * updateSymbolScope(const QgsSymbol *symbol, QgsExpressionContextScope *symbolScope=nullptr)
Updates a symbol scope related to a QgsSymbol to an expression context.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
static const QString EXPR_SYMBOL_COLOR
Inbuilt variable name for symbol color variable.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user.
static const QString EXPR_ORIGINAL_VALUE
Inbuilt variable name for value original value variable.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A line symbol type, for rendering LineString and MultiLineString geometries.
Base class for all map layer types.
void setBottom(double bottom)
Sets the bottom margin to bottom.
void setLeft(double left)
Sets the left margin to left.
void setRight(double right)
Sets the right margin to right.
void setTop(double top)
Sets the top margin to top.
A marker symbol type, for rendering Point and MultiPoint geometries.
A dialog to create a new auxiliary layer.
void setProperty(int key, const QgsProperty &property)
Adds a property to the collection and takes ownership of it.
void setField(const QString &field)
Sets the field name the property references.
A simple direct line callout style.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
QList< Qgis::RenderUnit > RenderUnitList
List of render units.
Represents a vector layer which manages a vector based dataset.
QgsAuxiliaryLayer * auxiliaryLayer()
Returns the current auxiliary layer.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Single variable definition for use within a QgsExpressionContextScope.