17#include "moc_qgscalloutwidget.cpp"
32 return *lExpressionContext;
37 expContext << symbolScope;
57 const auto unitSelectionWidgets = findChildren<QgsUnitSelectionWidget *>();
60 unitWidget->setMapCanvas( mContext.
mapCanvas() );
62 const auto symbolButtonWidgets = findChildren<QgsSymbolButton *>();
65 symbolWidget->setMapCanvas( mContext.
mapCanvas() );
66 symbolWidget->setMessageBar( mContext.
messageBar() );
84void QgsCalloutWidget::createAuxiliaryField()
114 property.setActive(
true );
123void QgsCalloutWidget::updateDataDefinedProperty()
137QgsSimpleLineCalloutWidget::QgsSimpleLineCalloutWidget(
QgsMapLayer *vl, QWidget *parent )
144 mCalloutLineStyleButton->setDialogTitle( tr(
"Callout Symbol" ) );
145 mCalloutLineStyleButton->registerExpressionContextGenerator(
this );
147 mCalloutLineStyleButton->setLayer( qobject_cast<QgsVectorLayer *>( vl ) );
153 connect( mMinCalloutLengthSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineCalloutWidget::minimumLengthChanged );
156 connect( mOffsetFromAnchorSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineCalloutWidget::offsetFromAnchorChanged );
158 connect( mOffsetFromLabelSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineCalloutWidget::offsetFromLabelChanged );
160 connect( mDrawToAllPartsCheck, &QCheckBox::toggled,
this, &QgsSimpleLineCalloutWidget::drawToAllPartsToggled );
167 connect( mAnchorPointComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineCalloutWidget::mAnchorPointComboBox_currentIndexChanged );
179 connect( mLabelAnchorPointComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineCalloutWidget::mLabelAnchorPointComboBox_currentIndexChanged );
181 connect( mCalloutLineStyleButton, &
QgsSymbolButton::changed,
this, &QgsSimpleLineCalloutWidget::lineSymbolChanged );
183 connect( mCalloutBlendComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineCalloutWidget::mCalloutBlendComboBox_currentIndexChanged );
185 mPlacementDDGroupBox->setVisible( qobject_cast<QgsVectorLayer *>( vl ) );
188void QgsSimpleLineCalloutWidget::setCallout(
const QgsCallout *callout )
197 mMinCalloutWidthUnitWidget->blockSignals(
true );
198 mMinCalloutWidthUnitWidget->setUnit( mCallout->minimumLengthUnit() );
199 mMinCalloutWidthUnitWidget->setMapUnitScale( mCallout->minimumLengthMapUnitScale() );
200 mMinCalloutWidthUnitWidget->blockSignals(
false );
202 whileBlocking( mMinCalloutLengthSpin )->setValue( mCallout->minimumLength() );
204 mOffsetFromAnchorUnitWidget->blockSignals(
true );
205 mOffsetFromAnchorUnitWidget->setUnit( mCallout->offsetFromAnchorUnit() );
206 mOffsetFromAnchorUnitWidget->setMapUnitScale( mCallout->offsetFromAnchorMapUnitScale() );
207 mOffsetFromAnchorUnitWidget->blockSignals(
false );
208 mOffsetFromLabelUnitWidget->blockSignals(
true );
209 mOffsetFromLabelUnitWidget->setUnit( mCallout->offsetFromLabelUnit() );
210 mOffsetFromLabelUnitWidget->setMapUnitScale( mCallout->offsetFromLabelMapUnitScale() );
211 mOffsetFromLabelUnitWidget->blockSignals(
false );
212 whileBlocking( mOffsetFromAnchorSpin )->setValue( mCallout->offsetFromAnchor() );
213 whileBlocking( mOffsetFromLabelSpin )->setValue( mCallout->offsetFromLabel() );
215 whileBlocking( mCalloutLineStyleButton )->setSymbol( mCallout->lineSymbol()->clone() );
217 whileBlocking( mDrawToAllPartsCheck )->setChecked( mCallout->drawCalloutToAllParts() );
219 whileBlocking( mAnchorPointComboBox )->setCurrentIndex( mAnchorPointComboBox->findData(
static_cast<int>( callout->
anchorPoint() ) ) );
220 whileBlocking( mLabelAnchorPointComboBox )->setCurrentIndex( mLabelAnchorPointComboBox->findData(
static_cast<int>( callout->
labelAnchorPoint() ) ) );
222 whileBlocking( mCalloutBlendComboBox )->setBlendMode( mCallout->blendMode() );
241 mAnchorPointLbl->setEnabled( isPolygon );
242 mAnchorPointLbl->setVisible( isPolygon );
243 mAnchorPointComboBox->setEnabled( isPolygon );
244 mAnchorPointComboBox->setVisible( isPolygon );
245 mAnchorPointDDBtn->setEnabled( isPolygon );
246 mAnchorPointDDBtn->setVisible( isPolygon );
249QgsCallout *QgsSimpleLineCalloutWidget::callout()
251 return mCallout.get();
254void QgsSimpleLineCalloutWidget::minimumLengthChanged()
256 mCallout->setMinimumLength( mMinCalloutLengthSpin->value() );
260void QgsSimpleLineCalloutWidget::minimumLengthUnitWidgetChanged()
262 mCallout->setMinimumLengthUnit( mMinCalloutWidthUnitWidget->unit() );
263 mCallout->setMinimumLengthMapUnitScale( mMinCalloutWidthUnitWidget->getMapUnitScale() );
267void QgsSimpleLineCalloutWidget::offsetFromAnchorUnitWidgetChanged()
269 mCallout->setOffsetFromAnchorUnit( mOffsetFromAnchorUnitWidget->unit() );
270 mCallout->setOffsetFromAnchorMapUnitScale( mOffsetFromAnchorUnitWidget->getMapUnitScale() );
274void QgsSimpleLineCalloutWidget::offsetFromAnchorChanged()
276 mCallout->setOffsetFromAnchor( mOffsetFromAnchorSpin->value() );
280void QgsSimpleLineCalloutWidget::offsetFromLabelUnitWidgetChanged()
282 mCallout->setOffsetFromLabelUnit( mOffsetFromLabelUnitWidget->unit() );
283 mCallout->setOffsetFromLabelMapUnitScale( mOffsetFromLabelUnitWidget->getMapUnitScale() );
287void QgsSimpleLineCalloutWidget::offsetFromLabelChanged()
289 mCallout->setOffsetFromLabel( mOffsetFromLabelSpin->value() );
293void QgsSimpleLineCalloutWidget::lineSymbolChanged()
295 mCallout->setLineSymbol( mCalloutLineStyleButton->clonedSymbol<
QgsLineSymbol>() );
299void QgsSimpleLineCalloutWidget::mAnchorPointComboBox_currentIndexChanged(
int index )
301 mCallout->setAnchorPoint(
static_cast<QgsCallout::AnchorPoint>( mAnchorPointComboBox->itemData( index ).toInt() ) );
305void QgsSimpleLineCalloutWidget::mLabelAnchorPointComboBox_currentIndexChanged(
int index )
311void QgsSimpleLineCalloutWidget::mCalloutBlendComboBox_currentIndexChanged(
int )
313 mCallout->setBlendMode( mCalloutBlendComboBox->blendMode() );
317void QgsSimpleLineCalloutWidget::drawToAllPartsToggled(
bool active )
319 mCallout->setDrawCalloutToAllParts( active );
328QgsManhattanLineCalloutWidget::QgsManhattanLineCalloutWidget(
QgsMapLayer *vl, QWidget *parent )
329 : QgsSimpleLineCalloutWidget( vl, parent )
338QgsCurvedLineCalloutWidget::QgsCurvedLineCalloutWidget(
QgsMapLayer *vl, QWidget *parent )
345 mCalloutLineStyleButton->setDialogTitle( tr(
"Callout Symbol" ) );
346 mCalloutLineStyleButton->registerExpressionContextGenerator(
this );
348 mCalloutLineStyleButton->setLayer( qobject_cast<QgsVectorLayer *>( vl ) );
354 connect( mMinCalloutLengthSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsCurvedLineCalloutWidget::minimumLengthChanged );
357 connect( mOffsetFromAnchorSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsCurvedLineCalloutWidget::offsetFromAnchorChanged );
359 connect( mOffsetFromLabelSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsCurvedLineCalloutWidget::offsetFromLabelChanged );
361 connect( mDrawToAllPartsCheck, &QCheckBox::toggled,
this, &QgsCurvedLineCalloutWidget::drawToAllPartsToggled );
366 connect( mOrientationComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [=](
int index ) {
376 connect( mAnchorPointComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsCurvedLineCalloutWidget::mAnchorPointComboBox_currentIndexChanged );
388 connect( mLabelAnchorPointComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsCurvedLineCalloutWidget::mLabelAnchorPointComboBox_currentIndexChanged );
390 connect( mCalloutLineStyleButton, &
QgsSymbolButton::changed,
this, &QgsCurvedLineCalloutWidget::lineSymbolChanged );
392 connect( mCurvatureSlider, &QSlider::valueChanged,
this, [=](
int value ) { mCurvatureSpinBox->setValue( value / 10.0 ); } );
393 connect( mCurvatureSpinBox,
static_cast<void (
QgsDoubleSpinBox::* )(
double )
>( &QgsDoubleSpinBox::valueChanged ),
this, [=](
double value ) {
whileBlocking( mCurvatureSlider )->setValue( value * 10 ); } );
394 connect( mCurvatureSpinBox,
static_cast<void (
QgsDoubleSpinBox::* )(
double )
>( &QgsDoubleSpinBox::valueChanged ),
this, [=](
double value ) {
395 mCallout->setCurvature( value / 100.0 );
399 connect( mCalloutBlendComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsCurvedLineCalloutWidget::mCalloutBlendComboBox_currentIndexChanged );
401 mPlacementDDGroupBox->setVisible( qobject_cast<QgsVectorLayer *>( vl ) );
404void QgsCurvedLineCalloutWidget::setCallout(
const QgsCallout *callout )
413 mMinCalloutWidthUnitWidget->blockSignals(
true );
414 mMinCalloutWidthUnitWidget->setUnit( mCallout->minimumLengthUnit() );
415 mMinCalloutWidthUnitWidget->setMapUnitScale( mCallout->minimumLengthMapUnitScale() );
416 mMinCalloutWidthUnitWidget->blockSignals(
false );
418 whileBlocking( mMinCalloutLengthSpin )->setValue( mCallout->minimumLength() );
420 mOffsetFromAnchorUnitWidget->blockSignals(
true );
421 mOffsetFromAnchorUnitWidget->setUnit( mCallout->offsetFromAnchorUnit() );
422 mOffsetFromAnchorUnitWidget->setMapUnitScale( mCallout->offsetFromAnchorMapUnitScale() );
423 mOffsetFromAnchorUnitWidget->blockSignals(
false );
424 mOffsetFromLabelUnitWidget->blockSignals(
true );
425 mOffsetFromLabelUnitWidget->setUnit( mCallout->offsetFromLabelUnit() );
426 mOffsetFromLabelUnitWidget->setMapUnitScale( mCallout->offsetFromLabelMapUnitScale() );
427 mOffsetFromLabelUnitWidget->blockSignals(
false );
428 whileBlocking( mOffsetFromAnchorSpin )->setValue( mCallout->offsetFromAnchor() );
429 whileBlocking( mOffsetFromLabelSpin )->setValue( mCallout->offsetFromLabel() );
431 whileBlocking( mCalloutLineStyleButton )->setSymbol( mCallout->lineSymbol()->clone() );
433 whileBlocking( mDrawToAllPartsCheck )->setChecked( mCallout->drawCalloutToAllParts() );
435 whileBlocking( mOrientationComboBox )->setCurrentIndex( mOrientationComboBox->findData(
static_cast<int>( mCallout->orientation() ) ) );
437 whileBlocking( mAnchorPointComboBox )->setCurrentIndex( mAnchorPointComboBox->findData(
static_cast<int>( callout->
anchorPoint() ) ) );
438 whileBlocking( mLabelAnchorPointComboBox )->setCurrentIndex( mLabelAnchorPointComboBox->findData(
static_cast<int>( callout->
labelAnchorPoint() ) ) );
440 whileBlocking( mCalloutBlendComboBox )->setBlendMode( mCallout->blendMode() );
442 whileBlocking( mCurvatureSpinBox )->setValue( mCallout->curvature() * 100.0 );
443 whileBlocking( mCurvatureSlider )->setValue( mCallout->curvature() * 1000.0 );
464 mAnchorPointLbl->setEnabled( isPolygon );
465 mAnchorPointLbl->setVisible( isPolygon );
466 mAnchorPointComboBox->setEnabled( isPolygon );
467 mAnchorPointComboBox->setVisible( isPolygon );
468 mAnchorPointDDBtn->setEnabled( isPolygon );
469 mAnchorPointDDBtn->setVisible( isPolygon );
472QgsCallout *QgsCurvedLineCalloutWidget::callout()
474 return mCallout.get();
477void QgsCurvedLineCalloutWidget::minimumLengthChanged()
479 mCallout->setMinimumLength( mMinCalloutLengthSpin->value() );
483void QgsCurvedLineCalloutWidget::minimumLengthUnitWidgetChanged()
485 mCallout->setMinimumLengthUnit( mMinCalloutWidthUnitWidget->unit() );
486 mCallout->setMinimumLengthMapUnitScale( mMinCalloutWidthUnitWidget->getMapUnitScale() );
490void QgsCurvedLineCalloutWidget::offsetFromAnchorUnitWidgetChanged()
492 mCallout->setOffsetFromAnchorUnit( mOffsetFromAnchorUnitWidget->unit() );
493 mCallout->setOffsetFromAnchorMapUnitScale( mOffsetFromAnchorUnitWidget->getMapUnitScale() );
497void QgsCurvedLineCalloutWidget::offsetFromAnchorChanged()
499 mCallout->setOffsetFromAnchor( mOffsetFromAnchorSpin->value() );
503void QgsCurvedLineCalloutWidget::offsetFromLabelUnitWidgetChanged()
505 mCallout->setOffsetFromLabelUnit( mOffsetFromLabelUnitWidget->unit() );
506 mCallout->setOffsetFromLabelMapUnitScale( mOffsetFromLabelUnitWidget->getMapUnitScale() );
510void QgsCurvedLineCalloutWidget::offsetFromLabelChanged()
512 mCallout->setOffsetFromLabel( mOffsetFromLabelSpin->value() );
516void QgsCurvedLineCalloutWidget::lineSymbolChanged()
518 mCallout->setLineSymbol( mCalloutLineStyleButton->clonedSymbol<
QgsLineSymbol>() );
522void QgsCurvedLineCalloutWidget::mAnchorPointComboBox_currentIndexChanged(
int index )
524 mCallout->setAnchorPoint(
static_cast<QgsCallout::AnchorPoint>( mAnchorPointComboBox->itemData( index ).toInt() ) );
528void QgsCurvedLineCalloutWidget::mLabelAnchorPointComboBox_currentIndexChanged(
int index )
534void QgsCurvedLineCalloutWidget::mCalloutBlendComboBox_currentIndexChanged(
int )
536 mCallout->setBlendMode( mCalloutBlendComboBox->blendMode() );
540void QgsCurvedLineCalloutWidget::drawToAllPartsToggled(
bool active )
542 mCallout->setDrawCalloutToAllParts( active );
551QgsBalloonCalloutWidget::QgsBalloonCalloutWidget(
QgsMapLayer *vl, QWidget *parent )
558 mCalloutFillStyleButton->setDialogTitle( tr(
"Balloon Symbol" ) );
559 mCalloutFillStyleButton->registerExpressionContextGenerator(
this );
562 mMarkerSymbolButton->setDialogTitle( tr(
"Marker Symbol" ) );
563 mMarkerSymbolButton->registerExpressionContextGenerator(
this );
564 mMarkerSymbolButton->setShowNull(
true );
565 mMarkerSymbolButton->setToNull();
567 mCalloutFillStyleButton->setLayer( qobject_cast<QgsVectorLayer *>( vl ) );
568 mMarkerSymbolButton->setLayer( qobject_cast<QgsVectorLayer *>( vl ) );
574 mSpinBottomMargin->setClearValue( 0 );
575 mSpinTopMargin->setClearValue( 0 );
576 mSpinRightMargin->setClearValue( 0 );
577 mSpinLeftMargin->setClearValue( 0 );
578 mWedgeWidthSpin->setClearValue( 2.64 );
579 mCornerRadiusSpin->setClearValue( 0.0 );
582 connect( mOffsetFromAnchorSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsBalloonCalloutWidget::offsetFromAnchorChanged );
589 connect( mAnchorPointComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsBalloonCalloutWidget::mAnchorPointComboBox_currentIndexChanged );
594 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [=](
double value ) {
597 mCallout->setMargins( margins );
600 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [=](
double value ) {
603 mCallout->setMargins( margins );
606 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [=](
double value ) {
609 mCallout->setMargins( margins );
612 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [=](
double value ) {
615 mCallout->setMargins( margins );
619 mCallout->setMarginsUnit( mMarginUnitWidget->unit() );
624 mCallout->setWedgeWidthUnit( mWedgeWidthUnitWidget->unit() );
625 mCallout->setWedgeWidthMapUnitScale( mWedgeWidthUnitWidget->getMapUnitScale() );
628 connect( mWedgeWidthSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [=](
double value ) {
629 mCallout->setWedgeWidth( value );
634 mCallout->setCornerRadiusUnit( mCornerRadiusUnitWidget->unit() );
635 mCallout->setCornerRadiusMapUnitScale( mCornerRadiusUnitWidget->getMapUnitScale() );
638 connect( mCornerRadiusSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [=](
double value ) {
639 mCallout->setCornerRadius( value );
643 connect( mCalloutBlendComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsBalloonCalloutWidget::mCalloutBlendComboBox_currentIndexChanged );
645 mPlacementDDGroupBox->setVisible( qobject_cast<QgsVectorLayer *>( vl ) );
648void QgsBalloonCalloutWidget::setCallout(
const QgsCallout *callout )
657 mOffsetFromAnchorUnitWidget->blockSignals(
true );
658 mOffsetFromAnchorUnitWidget->setUnit( mCallout->offsetFromAnchorUnit() );
659 mOffsetFromAnchorUnitWidget->setMapUnitScale( mCallout->offsetFromAnchorMapUnitScale() );
660 mOffsetFromAnchorUnitWidget->blockSignals(
false );
661 whileBlocking( mOffsetFromAnchorSpin )->setValue( mCallout->offsetFromAnchor() );
663 whileBlocking( mSpinBottomMargin )->setValue( mCallout->margins().bottom() );
664 whileBlocking( mSpinTopMargin )->setValue( mCallout->margins().top() );
665 whileBlocking( mSpinLeftMargin )->setValue( mCallout->margins().left() );
666 whileBlocking( mSpinRightMargin )->setValue( mCallout->margins().right() );
667 whileBlocking( mMarginUnitWidget )->setUnit( mCallout->marginsUnit() );
669 mWedgeWidthUnitWidget->blockSignals(
true );
670 mWedgeWidthUnitWidget->setUnit( mCallout->wedgeWidthUnit() );
671 mWedgeWidthUnitWidget->setMapUnitScale( mCallout->wedgeWidthMapUnitScale() );
672 mWedgeWidthUnitWidget->blockSignals(
false );
673 whileBlocking( mWedgeWidthSpin )->setValue( mCallout->wedgeWidth() );
675 mCornerRadiusUnitWidget->blockSignals(
true );
676 mCornerRadiusUnitWidget->setUnit( mCallout->cornerRadiusUnit() );
677 mCornerRadiusUnitWidget->setMapUnitScale( mCallout->cornerRadiusMapUnitScale() );
678 mCornerRadiusUnitWidget->blockSignals(
false );
679 whileBlocking( mCornerRadiusSpin )->setValue( mCallout->cornerRadius() );
681 whileBlocking( mCalloutFillStyleButton )->setSymbol( mCallout->fillSymbol()->clone() );
683 whileBlocking( mMarkerSymbolButton )->setSymbol( marker->clone() );
687 whileBlocking( mAnchorPointComboBox )->setCurrentIndex( mAnchorPointComboBox->findData(
static_cast<int>( callout->
anchorPoint() ) ) );
689 whileBlocking( mCalloutBlendComboBox )->setBlendMode( mCallout->blendMode() );
705 mAnchorPointLbl->setEnabled( isPolygon );
706 mAnchorPointLbl->setVisible( isPolygon );
707 mAnchorPointComboBox->setEnabled( isPolygon );
708 mAnchorPointComboBox->setVisible( isPolygon );
709 mAnchorPointDDBtn->setEnabled( isPolygon );
710 mAnchorPointDDBtn->setVisible( isPolygon );
715 return mCallout.get();
718void QgsBalloonCalloutWidget::offsetFromAnchorUnitWidgetChanged()
720 mCallout->setOffsetFromAnchorUnit( mOffsetFromAnchorUnitWidget->unit() );
721 mCallout->setOffsetFromAnchorMapUnitScale( mOffsetFromAnchorUnitWidget->getMapUnitScale() );
725void QgsBalloonCalloutWidget::offsetFromAnchorChanged()
727 mCallout->setOffsetFromAnchor( mOffsetFromAnchorSpin->value() );
731void QgsBalloonCalloutWidget::fillSymbolChanged()
733 mCallout->setFillSymbol( mCalloutFillStyleButton->clonedSymbol<
QgsFillSymbol>() );
737void QgsBalloonCalloutWidget::markerSymbolChanged()
739 mCallout->setMarkerSymbol( mMarkerSymbolButton->isNull() ?
nullptr : mMarkerSymbolButton->clonedSymbol<
QgsMarkerSymbol>() );
743void QgsBalloonCalloutWidget::mAnchorPointComboBox_currentIndexChanged(
int index )
745 mCallout->setAnchorPoint(
static_cast<QgsCallout::AnchorPoint>( mAnchorPointComboBox->itemData( index ).toInt() ) );
749void QgsBalloonCalloutWidget::mCalloutBlendComboBox_currentIndexChanged(
int )
751 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.
bool addAuxiliaryField(const QgsPropertyDefinition &definition)
Adds an auxiliary field for the given property.
bool exists(const QgsPropertyDefinition &definition) const
Returns true if the property is stored in the layer already, false otherwise.
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...
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
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.
The QgsMargins class defines the four margins of a rectangle.
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.
Definition for a property.
A store for object properties.
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< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer.
QList< QgsExpressionContextScope * > globalProjectAtlasMapLayerScopes(const QgsMapLayer *layer) const
Returns list of scopes: global, project, atlas, map, layer.
QgsExpressionContext * expressionContext() const
Returns the expression context used for the widget, if set.
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
QList< Qgis::RenderUnit > RenderUnitList
List of render units.
Represents a vector layer which manages a vector based data sets.
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.