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 ) );
155 connect( mMinCalloutLengthSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineCalloutWidget::minimumLengthChanged );
158 connect( mOffsetFromAnchorSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineCalloutWidget::offsetFromAnchorChanged );
160 connect( mOffsetFromLabelSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineCalloutWidget::offsetFromLabelChanged );
162 connect( mDrawToAllPartsCheck, &QCheckBox::toggled,
this, &QgsSimpleLineCalloutWidget::drawToAllPartsToggled );
169 connect( mAnchorPointComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineCalloutWidget::mAnchorPointComboBox_currentIndexChanged );
181 connect( mLabelAnchorPointComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineCalloutWidget::mLabelAnchorPointComboBox_currentIndexChanged );
183 connect( mCalloutLineStyleButton, &
QgsSymbolButton::changed,
this, &QgsSimpleLineCalloutWidget::lineSymbolChanged );
185 connect( mCalloutBlendComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineCalloutWidget::mCalloutBlendComboBox_currentIndexChanged );
187 mPlacementDDGroupBox->setVisible( qobject_cast<QgsVectorLayer *>( vl ) );
190void QgsSimpleLineCalloutWidget::setCallout(
const QgsCallout *callout )
199 mMinCalloutWidthUnitWidget->blockSignals(
true );
200 mMinCalloutWidthUnitWidget->setUnit( mCallout->minimumLengthUnit() );
201 mMinCalloutWidthUnitWidget->setMapUnitScale( mCallout->minimumLengthMapUnitScale() );
202 mMinCalloutWidthUnitWidget->blockSignals(
false );
204 whileBlocking( mMinCalloutLengthSpin )->setValue( mCallout->minimumLength() );
206 mOffsetFromAnchorUnitWidget->blockSignals(
true );
207 mOffsetFromAnchorUnitWidget->setUnit( mCallout->offsetFromAnchorUnit() );
208 mOffsetFromAnchorUnitWidget->setMapUnitScale( mCallout->offsetFromAnchorMapUnitScale() );
209 mOffsetFromAnchorUnitWidget->blockSignals(
false );
210 mOffsetFromLabelUnitWidget->blockSignals(
true );
211 mOffsetFromLabelUnitWidget->setUnit( mCallout->offsetFromLabelUnit() );
212 mOffsetFromLabelUnitWidget->setMapUnitScale( mCallout->offsetFromLabelMapUnitScale() );
213 mOffsetFromLabelUnitWidget->blockSignals(
false );
214 whileBlocking( mOffsetFromAnchorSpin )->setValue( mCallout->offsetFromAnchor() );
215 whileBlocking( mOffsetFromLabelSpin )->setValue( mCallout->offsetFromLabel() );
217 whileBlocking( mCalloutLineStyleButton )->setSymbol( mCallout->lineSymbol()->clone() );
219 whileBlocking( mDrawToAllPartsCheck )->setChecked( mCallout->drawCalloutToAllParts() );
221 whileBlocking( mAnchorPointComboBox )->setCurrentIndex( mAnchorPointComboBox->findData(
static_cast<int>( callout->
anchorPoint() ) ) );
222 whileBlocking( mLabelAnchorPointComboBox )->setCurrentIndex( mLabelAnchorPointComboBox->findData(
static_cast<int>( callout->
labelAnchorPoint() ) ) );
224 whileBlocking( mCalloutBlendComboBox )->setBlendMode( mCallout->blendMode() );
243 mAnchorPointLbl->setEnabled( isPolygon );
244 mAnchorPointLbl->setVisible( isPolygon );
245 mAnchorPointComboBox->setEnabled( isPolygon );
246 mAnchorPointComboBox->setVisible( isPolygon );
247 mAnchorPointDDBtn->setEnabled( isPolygon );
248 mAnchorPointDDBtn->setVisible( isPolygon );
251QgsCallout *QgsSimpleLineCalloutWidget::callout()
253 return mCallout.get();
256void QgsSimpleLineCalloutWidget::minimumLengthChanged()
258 mCallout->setMinimumLength( mMinCalloutLengthSpin->value() );
262void QgsSimpleLineCalloutWidget::minimumLengthUnitWidgetChanged()
264 mCallout->setMinimumLengthUnit( mMinCalloutWidthUnitWidget->unit() );
265 mCallout->setMinimumLengthMapUnitScale( mMinCalloutWidthUnitWidget->getMapUnitScale() );
269void QgsSimpleLineCalloutWidget::offsetFromAnchorUnitWidgetChanged()
271 mCallout->setOffsetFromAnchorUnit( mOffsetFromAnchorUnitWidget->unit() );
272 mCallout->setOffsetFromAnchorMapUnitScale( mOffsetFromAnchorUnitWidget->getMapUnitScale() );
276void QgsSimpleLineCalloutWidget::offsetFromAnchorChanged()
278 mCallout->setOffsetFromAnchor( mOffsetFromAnchorSpin->value() );
282void QgsSimpleLineCalloutWidget::offsetFromLabelUnitWidgetChanged()
284 mCallout->setOffsetFromLabelUnit( mOffsetFromLabelUnitWidget->unit() );
285 mCallout->setOffsetFromLabelMapUnitScale( mOffsetFromLabelUnitWidget->getMapUnitScale() );
289void QgsSimpleLineCalloutWidget::offsetFromLabelChanged()
291 mCallout->setOffsetFromLabel( mOffsetFromLabelSpin->value() );
295void QgsSimpleLineCalloutWidget::lineSymbolChanged()
297 mCallout->setLineSymbol( mCalloutLineStyleButton->clonedSymbol<
QgsLineSymbol>() );
301void QgsSimpleLineCalloutWidget::mAnchorPointComboBox_currentIndexChanged(
int index )
303 mCallout->setAnchorPoint(
static_cast<QgsCallout::AnchorPoint>( mAnchorPointComboBox->itemData( index ).toInt() ) );
307void QgsSimpleLineCalloutWidget::mLabelAnchorPointComboBox_currentIndexChanged(
int index )
313void QgsSimpleLineCalloutWidget::mCalloutBlendComboBox_currentIndexChanged(
int )
315 mCallout->setBlendMode( mCalloutBlendComboBox->blendMode() );
319void QgsSimpleLineCalloutWidget::drawToAllPartsToggled(
bool active )
321 mCallout->setDrawCalloutToAllParts( active );
330QgsManhattanLineCalloutWidget::QgsManhattanLineCalloutWidget(
QgsMapLayer *vl, QWidget *parent )
331 : QgsSimpleLineCalloutWidget( vl, parent )
340QgsCurvedLineCalloutWidget::QgsCurvedLineCalloutWidget(
QgsMapLayer *vl, QWidget *parent )
347 mCalloutLineStyleButton->setDialogTitle( tr(
"Callout Symbol" ) );
348 mCalloutLineStyleButton->registerExpressionContextGenerator(
this );
350 mCalloutLineStyleButton->setLayer( qobject_cast<QgsVectorLayer *>( vl ) );
356 connect( mMinCalloutLengthSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsCurvedLineCalloutWidget::minimumLengthChanged );
359 connect( mOffsetFromAnchorSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsCurvedLineCalloutWidget::offsetFromAnchorChanged );
361 connect( mOffsetFromLabelSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsCurvedLineCalloutWidget::offsetFromLabelChanged );
363 connect( mDrawToAllPartsCheck, &QCheckBox::toggled,
this, &QgsCurvedLineCalloutWidget::drawToAllPartsToggled );
368 connect( mOrientationComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this](
int index ) {
378 connect( mAnchorPointComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsCurvedLineCalloutWidget::mAnchorPointComboBox_currentIndexChanged );
390 connect( mLabelAnchorPointComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsCurvedLineCalloutWidget::mLabelAnchorPointComboBox_currentIndexChanged );
392 connect( mCalloutLineStyleButton, &
QgsSymbolButton::changed,
this, &QgsCurvedLineCalloutWidget::lineSymbolChanged );
394 connect( mCurvatureSlider, &QSlider::valueChanged,
this, [
this](
int value ) { mCurvatureSpinBox->setValue( value / 10.0 ); } );
395 connect( mCurvatureSpinBox,
static_cast<void ( QgsDoubleSpinBox::* )(
double )
>( &QgsDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
whileBlocking( mCurvatureSlider )->setValue( value * 10 ); } );
396 connect( mCurvatureSpinBox,
static_cast<void ( QgsDoubleSpinBox::* )(
double )
>( &QgsDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
397 mCallout->setCurvature( value / 100.0 );
401 connect( mCalloutBlendComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsCurvedLineCalloutWidget::mCalloutBlendComboBox_currentIndexChanged );
403 mPlacementDDGroupBox->setVisible( qobject_cast<QgsVectorLayer *>( vl ) );
406void QgsCurvedLineCalloutWidget::setCallout(
const QgsCallout *callout )
415 mMinCalloutWidthUnitWidget->blockSignals(
true );
416 mMinCalloutWidthUnitWidget->setUnit( mCallout->minimumLengthUnit() );
417 mMinCalloutWidthUnitWidget->setMapUnitScale( mCallout->minimumLengthMapUnitScale() );
418 mMinCalloutWidthUnitWidget->blockSignals(
false );
420 whileBlocking( mMinCalloutLengthSpin )->setValue( mCallout->minimumLength() );
422 mOffsetFromAnchorUnitWidget->blockSignals(
true );
423 mOffsetFromAnchorUnitWidget->setUnit( mCallout->offsetFromAnchorUnit() );
424 mOffsetFromAnchorUnitWidget->setMapUnitScale( mCallout->offsetFromAnchorMapUnitScale() );
425 mOffsetFromAnchorUnitWidget->blockSignals(
false );
426 mOffsetFromLabelUnitWidget->blockSignals(
true );
427 mOffsetFromLabelUnitWidget->setUnit( mCallout->offsetFromLabelUnit() );
428 mOffsetFromLabelUnitWidget->setMapUnitScale( mCallout->offsetFromLabelMapUnitScale() );
429 mOffsetFromLabelUnitWidget->blockSignals(
false );
430 whileBlocking( mOffsetFromAnchorSpin )->setValue( mCallout->offsetFromAnchor() );
431 whileBlocking( mOffsetFromLabelSpin )->setValue( mCallout->offsetFromLabel() );
433 whileBlocking( mCalloutLineStyleButton )->setSymbol( mCallout->lineSymbol()->clone() );
435 whileBlocking( mDrawToAllPartsCheck )->setChecked( mCallout->drawCalloutToAllParts() );
437 whileBlocking( mOrientationComboBox )->setCurrentIndex( mOrientationComboBox->findData(
static_cast<int>( mCallout->orientation() ) ) );
439 whileBlocking( mAnchorPointComboBox )->setCurrentIndex( mAnchorPointComboBox->findData(
static_cast<int>( callout->
anchorPoint() ) ) );
440 whileBlocking( mLabelAnchorPointComboBox )->setCurrentIndex( mLabelAnchorPointComboBox->findData(
static_cast<int>( callout->
labelAnchorPoint() ) ) );
442 whileBlocking( mCalloutBlendComboBox )->setBlendMode( mCallout->blendMode() );
444 whileBlocking( mCurvatureSpinBox )->setValue( mCallout->curvature() * 100.0 );
445 whileBlocking( mCurvatureSlider )->setValue( mCallout->curvature() * 1000.0 );
466 mAnchorPointLbl->setEnabled( isPolygon );
467 mAnchorPointLbl->setVisible( isPolygon );
468 mAnchorPointComboBox->setEnabled( isPolygon );
469 mAnchorPointComboBox->setVisible( isPolygon );
470 mAnchorPointDDBtn->setEnabled( isPolygon );
471 mAnchorPointDDBtn->setVisible( isPolygon );
474QgsCallout *QgsCurvedLineCalloutWidget::callout()
476 return mCallout.get();
479void QgsCurvedLineCalloutWidget::minimumLengthChanged()
481 mCallout->setMinimumLength( mMinCalloutLengthSpin->value() );
485void QgsCurvedLineCalloutWidget::minimumLengthUnitWidgetChanged()
487 mCallout->setMinimumLengthUnit( mMinCalloutWidthUnitWidget->unit() );
488 mCallout->setMinimumLengthMapUnitScale( mMinCalloutWidthUnitWidget->getMapUnitScale() );
492void QgsCurvedLineCalloutWidget::offsetFromAnchorUnitWidgetChanged()
494 mCallout->setOffsetFromAnchorUnit( mOffsetFromAnchorUnitWidget->unit() );
495 mCallout->setOffsetFromAnchorMapUnitScale( mOffsetFromAnchorUnitWidget->getMapUnitScale() );
499void QgsCurvedLineCalloutWidget::offsetFromAnchorChanged()
501 mCallout->setOffsetFromAnchor( mOffsetFromAnchorSpin->value() );
505void QgsCurvedLineCalloutWidget::offsetFromLabelUnitWidgetChanged()
507 mCallout->setOffsetFromLabelUnit( mOffsetFromLabelUnitWidget->unit() );
508 mCallout->setOffsetFromLabelMapUnitScale( mOffsetFromLabelUnitWidget->getMapUnitScale() );
512void QgsCurvedLineCalloutWidget::offsetFromLabelChanged()
514 mCallout->setOffsetFromLabel( mOffsetFromLabelSpin->value() );
518void QgsCurvedLineCalloutWidget::lineSymbolChanged()
520 mCallout->setLineSymbol( mCalloutLineStyleButton->clonedSymbol<
QgsLineSymbol>() );
524void QgsCurvedLineCalloutWidget::mAnchorPointComboBox_currentIndexChanged(
int index )
526 mCallout->setAnchorPoint(
static_cast<QgsCallout::AnchorPoint>( mAnchorPointComboBox->itemData( index ).toInt() ) );
530void QgsCurvedLineCalloutWidget::mLabelAnchorPointComboBox_currentIndexChanged(
int index )
536void QgsCurvedLineCalloutWidget::mCalloutBlendComboBox_currentIndexChanged(
int )
538 mCallout->setBlendMode( mCalloutBlendComboBox->blendMode() );
542void QgsCurvedLineCalloutWidget::drawToAllPartsToggled(
bool active )
544 mCallout->setDrawCalloutToAllParts( active );
553QgsBalloonCalloutWidget::QgsBalloonCalloutWidget(
QgsMapLayer *vl, QWidget *parent )
560 mCalloutFillStyleButton->setDialogTitle( tr(
"Balloon Symbol" ) );
561 mCalloutFillStyleButton->registerExpressionContextGenerator(
this );
564 mMarkerSymbolButton->setDialogTitle( tr(
"Marker Symbol" ) );
565 mMarkerSymbolButton->registerExpressionContextGenerator(
this );
566 mMarkerSymbolButton->setShowNull(
true );
567 mMarkerSymbolButton->setToNull();
569 mCalloutFillStyleButton->setLayer( qobject_cast<QgsVectorLayer *>( vl ) );
570 mMarkerSymbolButton->setLayer( qobject_cast<QgsVectorLayer *>( vl ) );
576 mSpinBottomMargin->setClearValue( 0 );
577 mSpinTopMargin->setClearValue( 0 );
578 mSpinRightMargin->setClearValue( 0 );
579 mSpinLeftMargin->setClearValue( 0 );
580 mWedgeWidthSpin->setClearValue( 2.64 );
581 mCornerRadiusSpin->setClearValue( 0.0 );
584 connect( mOffsetFromAnchorSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsBalloonCalloutWidget::offsetFromAnchorChanged );
591 connect( mAnchorPointComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsBalloonCalloutWidget::mAnchorPointComboBox_currentIndexChanged );
596 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
597 QgsMargins margins = mCallout->margins();
599 mCallout->setMargins( margins );
602 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
603 QgsMargins margins = mCallout->margins();
605 mCallout->setMargins( margins );
608 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
609 QgsMargins margins = mCallout->margins();
611 mCallout->setMargins( margins );
614 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
615 QgsMargins margins = mCallout->margins();
617 mCallout->setMargins( margins );
621 mCallout->setMarginsUnit( mMarginUnitWidget->unit() );
626 mCallout->setWedgeWidthUnit( mWedgeWidthUnitWidget->unit() );
627 mCallout->setWedgeWidthMapUnitScale( mWedgeWidthUnitWidget->getMapUnitScale() );
630 connect( mWedgeWidthSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
631 mCallout->setWedgeWidth( value );
636 mCallout->setCornerRadiusUnit( mCornerRadiusUnitWidget->unit() );
637 mCallout->setCornerRadiusMapUnitScale( mCornerRadiusUnitWidget->getMapUnitScale() );
640 connect( mCornerRadiusSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
641 mCallout->setCornerRadius( value );
645 connect( mCalloutBlendComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsBalloonCalloutWidget::mCalloutBlendComboBox_currentIndexChanged );
647 mPlacementDDGroupBox->setVisible( qobject_cast<QgsVectorLayer *>( vl ) );
650void QgsBalloonCalloutWidget::setCallout(
const QgsCallout *callout )
659 mOffsetFromAnchorUnitWidget->blockSignals(
true );
660 mOffsetFromAnchorUnitWidget->setUnit( mCallout->offsetFromAnchorUnit() );
661 mOffsetFromAnchorUnitWidget->setMapUnitScale( mCallout->offsetFromAnchorMapUnitScale() );
662 mOffsetFromAnchorUnitWidget->blockSignals(
false );
663 whileBlocking( mOffsetFromAnchorSpin )->setValue( mCallout->offsetFromAnchor() );
665 whileBlocking( mSpinBottomMargin )->setValue( mCallout->margins().bottom() );
666 whileBlocking( mSpinTopMargin )->setValue( mCallout->margins().top() );
667 whileBlocking( mSpinLeftMargin )->setValue( mCallout->margins().left() );
668 whileBlocking( mSpinRightMargin )->setValue( mCallout->margins().right() );
669 whileBlocking( mMarginUnitWidget )->setUnit( mCallout->marginsUnit() );
671 mWedgeWidthUnitWidget->blockSignals(
true );
672 mWedgeWidthUnitWidget->setUnit( mCallout->wedgeWidthUnit() );
673 mWedgeWidthUnitWidget->setMapUnitScale( mCallout->wedgeWidthMapUnitScale() );
674 mWedgeWidthUnitWidget->blockSignals(
false );
675 whileBlocking( mWedgeWidthSpin )->setValue( mCallout->wedgeWidth() );
677 mCornerRadiusUnitWidget->blockSignals(
true );
678 mCornerRadiusUnitWidget->setUnit( mCallout->cornerRadiusUnit() );
679 mCornerRadiusUnitWidget->setMapUnitScale( mCallout->cornerRadiusMapUnitScale() );
680 mCornerRadiusUnitWidget->blockSignals(
false );
681 whileBlocking( mCornerRadiusSpin )->setValue( mCallout->cornerRadius() );
683 whileBlocking( mCalloutFillStyleButton )->setSymbol( mCallout->fillSymbol()->clone() );
685 whileBlocking( mMarkerSymbolButton )->setSymbol( marker->clone() );
689 whileBlocking( mAnchorPointComboBox )->setCurrentIndex( mAnchorPointComboBox->findData(
static_cast<int>( callout->
anchorPoint() ) ) );
691 whileBlocking( mCalloutBlendComboBox )->setBlendMode( mCallout->blendMode() );
707 mAnchorPointLbl->setEnabled( isPolygon );
708 mAnchorPointLbl->setVisible( isPolygon );
709 mAnchorPointComboBox->setEnabled( isPolygon );
710 mAnchorPointComboBox->setVisible( isPolygon );
711 mAnchorPointDDBtn->setEnabled( isPolygon );
712 mAnchorPointDDBtn->setVisible( isPolygon );
717 return mCallout.get();
720void QgsBalloonCalloutWidget::offsetFromAnchorUnitWidgetChanged()
722 mCallout->setOffsetFromAnchorUnit( mOffsetFromAnchorUnitWidget->unit() );
723 mCallout->setOffsetFromAnchorMapUnitScale( mOffsetFromAnchorUnitWidget->getMapUnitScale() );
727void QgsBalloonCalloutWidget::offsetFromAnchorChanged()
729 mCallout->setOffsetFromAnchor( mOffsetFromAnchorSpin->value() );
733void QgsBalloonCalloutWidget::fillSymbolChanged()
735 mCallout->setFillSymbol( mCalloutFillStyleButton->clonedSymbol<
QgsFillSymbol>() );
739void QgsBalloonCalloutWidget::markerSymbolChanged()
741 mCallout->setMarkerSymbol( mMarkerSymbolButton->isNull() ?
nullptr : mMarkerSymbolButton->clonedSymbol<
QgsMarkerSymbol>() );
745void QgsBalloonCalloutWidget::mAnchorPointComboBox_currentIndexChanged(
int index )
747 mCallout->setAnchorPoint(
static_cast<QgsCallout::AnchorPoint>( mAnchorPointComboBox->itemData( index ).toInt() ) );
751void QgsBalloonCalloutWidget::mCalloutBlendComboBox_currentIndexChanged(
int )
753 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.