29#include <QColorDialog>
35 , mScalebar( scaleBar )
39 mNumberOfSubdivisionsSpinBox->setClearValue( 1 );
41 connect( mHeightSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutScaleBarWidget::mHeightSpinBox_valueChanged );
42 connect( mSegmentSizeSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutScaleBarWidget::mSegmentSizeSpinBox_valueChanged );
43 connect( mSegmentsLeftSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsLayoutScaleBarWidget::mSegmentsLeftSpinBox_valueChanged );
44 connect( mNumberOfSegmentsSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsLayoutScaleBarWidget::mNumberOfSegmentsSpinBox_valueChanged );
45 connect( mNumberOfSubdivisionsSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsLayoutScaleBarWidget::mNumberOfSubdivisionsSpinBox_valueChanged );
46 connect( mSubdivisionsHeightSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutScaleBarWidget::mSubdivisionsHeightSpinBox_valueChanged );
47 connect( mUnitLabelLineEdit, &QLineEdit::textChanged,
this, &QgsLayoutScaleBarWidget::mUnitLabelLineEdit_textChanged );
48 connect( mMapUnitsPerBarUnitSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutScaleBarWidget::mMapUnitsPerBarUnitSpinBox_valueChanged );
49 connect( mStyleComboBox, &QComboBox::currentTextChanged,
this, &QgsLayoutScaleBarWidget::mStyleComboBox_currentIndexChanged );
50 connect( mLabelBarSpaceSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutScaleBarWidget::mLabelBarSpaceSpinBox_valueChanged );
51 connect( mBoxSizeSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutScaleBarWidget::mBoxSizeSpinBox_valueChanged );
53 connect( mLabelVerticalPlacementComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutScaleBarWidget::mLabelVerticalPlacementComboBox_currentIndexChanged );
54 connect( mLabelHorizontalPlacementComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutScaleBarWidget::mLabelHorizontalPlacementComboBox_currentIndexChanged );
55 connect( mUnitsComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutScaleBarWidget::mUnitsComboBox_currentIndexChanged );
56 connect( mMinWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutScaleBarWidget::mMinWidthSpinBox_valueChanged );
57 connect( mMaxWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutScaleBarWidget::mMaxWidthSpinBox_valueChanged );
58 connect( mNumberFormatPushButton, &QPushButton::clicked,
this, &QgsLayoutScaleBarWidget::changeNumberFormat );
69 mSegmentsLeftDDBtn->registerEnabledWidget( mSegmentsLeftSpinBox,
false );
70 mSegmentsRightDDBtn->registerEnabledWidget( mNumberOfSegmentsSpinBox,
false );
71 mSegmentSizeDDBtn->registerEnabledWidget( mSegmentSizeSpinBox,
false );
72 mMinWidthDDBtn->registerEnabledWidget( mMinWidthSpinBox,
false );
73 mMaxWidthDDBtn->registerEnabledWidget( mMaxWidthSpinBox,
false );
77 mFontButton->registerExpressionContextGenerator(
this );
79 connectUpdateSignal();
83 mainLayout->addWidget( mItemPropertiesWidget );
85 mSegmentSizeRadioGroup.addButton( mFixedSizeRadio );
86 mSegmentSizeRadioGroup.addButton( mFitWidthRadio );
87 connect( &mSegmentSizeRadioGroup,
static_cast < void ( QButtonGroup::* )( QAbstractButton * )
> ( &QButtonGroup::buttonClicked ),
this, &QgsLayoutScaleBarWidget::segmentSizeRadioChanged );
89 blockMemberSignals(
true );
93 for (
const QString &renderer : renderers )
105 mAlignmentComboBox->setAvailableAlignments( Qt::AlignLeft | Qt::AlignHCenter | Qt::AlignRight );
108 mUnitsComboBox->addItem( tr(
"Map units" ),
static_cast< int >( Qgis::DistanceUnit::Unknown ) );
109 mUnitsComboBox->addItem( tr(
"Meters" ),
static_cast< int >( Qgis::DistanceUnit::Meters ) );
110 mUnitsComboBox->addItem( tr(
"Kilometers" ),
static_cast< int >( Qgis::DistanceUnit::Kilometers ) );
111 mUnitsComboBox->addItem( tr(
"Feet" ),
static_cast< int >( Qgis::DistanceUnit::Feet ) );
112 mUnitsComboBox->addItem( tr(
"Yards" ),
static_cast< int >( Qgis::DistanceUnit::Yards ) );
113 mUnitsComboBox->addItem( tr(
"Miles" ),
static_cast< int >( Qgis::DistanceUnit::Miles ) );
114 mUnitsComboBox->addItem( tr(
"Nautical Miles" ),
static_cast< int >( Qgis::DistanceUnit::NauticalMiles ) );
115 mUnitsComboBox->addItem( tr(
"Centimeters" ),
static_cast< int >( Qgis::DistanceUnit::Centimeters ) );
116 mUnitsComboBox->addItem( tr(
"Millimeters" ),
static_cast< int >( Qgis::DistanceUnit::Millimeters ) );
125 connect( mSubdivisionStyleButton, &
QgsSymbolButton::changed,
this, &QgsLayoutScaleBarWidget::subdivisionSymbolChanged );
133 mFontButton->setDialogTitle( tr(
"Scalebar Font" ) );
138 QgsLayout *scaleBarLayout = mScalebar->layout();
139 if ( scaleBarLayout )
141 mMapItemComboBox->setCurrentLayout( scaleBarLayout );
148 blockMemberSignals(
false );
151 mLineStyleButton->registerExpressionContextGenerator( mScalebar );
153 mDivisionStyleButton->registerExpressionContextGenerator( mScalebar );
155 mSubdivisionStyleButton->registerExpressionContextGenerator( mScalebar );
157 mFillSymbol1Button->registerExpressionContextGenerator( mScalebar );
159 mFillSymbol2Button->registerExpressionContextGenerator( mScalebar );
164 if ( mScalebar->layout() )
177 if ( mItemPropertiesWidget )
196 disconnectUpdateSignal();
198 mScalebar = qobject_cast< QgsLayoutItemScaleBar * >( item );
199 mItemPropertiesWidget->
setItem( mScalebar );
203 connectUpdateSignal();
204 mFillSymbol1Button->registerExpressionContextGenerator( mScalebar );
205 mFillSymbol2Button->registerExpressionContextGenerator( mScalebar );
206 mLineStyleButton->registerExpressionContextGenerator( mScalebar );
207 mDivisionStyleButton->registerExpressionContextGenerator( mScalebar );
208 mSubdivisionStyleButton->registerExpressionContextGenerator( mScalebar );
216void QgsLayoutScaleBarWidget::lineSymbolChanged()
222 mScalebar->setLineSymbol( mLineStyleButton->clonedSymbol<
QgsLineSymbol>() );
224 mScalebar->layout()->undoStack()->endCommand();
227void QgsLayoutScaleBarWidget::divisionSymbolChanged()
233 mScalebar->setDivisionLineSymbol( mDivisionStyleButton->clonedSymbol<
QgsLineSymbol>() );
235 mScalebar->layout()->undoStack()->endCommand();
238void QgsLayoutScaleBarWidget::subdivisionSymbolChanged()
244 mScalebar->setSubdivisionLineSymbol( mSubdivisionStyleButton->clonedSymbol<
QgsLineSymbol>() );
246 mScalebar->layout()->undoStack()->endCommand();
249void QgsLayoutScaleBarWidget::fillSymbol1Changed()
255 mScalebar->setFillSymbol( mFillSymbol1Button->clonedSymbol<
QgsFillSymbol>() );
257 mScalebar->layout()->undoStack()->endCommand();
260void QgsLayoutScaleBarWidget::fillSymbol2Changed()
266 mScalebar->setAlternateFillSymbol( mFillSymbol2Button->clonedSymbol<
QgsFillSymbol>() );
268 mScalebar->layout()->undoStack()->endCommand();
271void QgsLayoutScaleBarWidget::setGuiElements()
278 blockMemberSignals(
true );
279 mNumberOfSegmentsSpinBox->setValue( mScalebar->numberOfSegments() );
280 mSegmentsLeftSpinBox->setValue( mScalebar->numberOfSegmentsLeft() );
281 mSegmentSizeSpinBox->setValue( mScalebar->unitsPerSegment() );
282 mHeightSpinBox->setValue( mScalebar->height() );
283 mNumberOfSubdivisionsSpinBox->setValue( mScalebar->numberOfSubdivisions() );
284 mSubdivisionsHeightSpinBox->setValue( mScalebar->subdivisionsHeight() );
285 mMapUnitsPerBarUnitSpinBox->setValue( mScalebar->mapUnitsPerScaleBarUnit() );
286 mLabelBarSpaceSpinBox->setValue( mScalebar->labelBarSpace() );
287 mBoxSizeSpinBox->setValue( mScalebar->boxContentSpace() );
288 mUnitLabelLineEdit->setText( mScalebar->unitLabel() );
289 mFontButton->setTextFormat( mScalebar->textFormat() );
291 whileBlocking( mLineStyleButton )->setSymbol( mScalebar->lineSymbol()->clone() );
292 whileBlocking( mDivisionStyleButton )->setSymbol( mScalebar->divisionLineSymbol()->clone() );
293 whileBlocking( mSubdivisionStyleButton )->setSymbol( mScalebar->subdivisionLineSymbol()->clone() );
294 whileBlocking( mFillSymbol1Button )->setSymbol( mScalebar->fillSymbol()->clone() );
295 whileBlocking( mFillSymbol2Button )->setSymbol( mScalebar->alternateFillSymbol()->clone() );
298 mMapItemComboBox->setItem( mScalebar->linkedMap() );
301 const QString style = mScalebar->style();
302 mStyleComboBox->setCurrentIndex( mStyleComboBox->findData( style ) );
303 toggleStyleSpecificControls( style );
306 mLabelVerticalPlacementComboBox->setCurrentIndex( mLabelVerticalPlacementComboBox->findData(
static_cast< int >( mScalebar->labelVerticalPlacement() ) ) );
307 mLabelHorizontalPlacementComboBox->setCurrentIndex( mLabelHorizontalPlacementComboBox->findData(
static_cast< int >( mScalebar->labelHorizontalPlacement() ) ) );
311 Qt::Alignment a = Qt::AlignLeft;
312 switch ( mScalebar->alignment() )
321 a = Qt::AlignHCenter;
324 mAlignmentComboBox->setCurrentAlignment( a );
327 mUnitsComboBox->setCurrentIndex( mUnitsComboBox->findData(
static_cast< int >( mScalebar->units() ) ) );
331 mFixedSizeRadio->setChecked(
true );
332 mSegmentSizeSpinBox->setEnabled(
true );
333 mMinWidthSpinBox->setEnabled(
false );
334 mMaxWidthSpinBox->setEnabled(
false );
338 mFitWidthRadio->setChecked(
true );
339 mSegmentSizeSpinBox->setEnabled(
false );
340 mMinWidthSpinBox->setEnabled(
true );
341 mMaxWidthSpinBox->setEnabled(
true );
343 mMinWidthSpinBox->setValue( mScalebar->minimumBarWidth() );
344 mMaxWidthSpinBox->setValue( mScalebar->maximumBarWidth() );
346 populateDataDefinedButtons();
348 blockMemberSignals(
false );
353void QgsLayoutScaleBarWidget::mSegmentSizeSpinBox_valueChanged(
double d )
361 disconnectUpdateSignal();
362 mScalebar->setUnitsPerSegment( d );
364 connectUpdateSignal();
365 mScalebar->endCommand();
368void QgsLayoutScaleBarWidget::mSegmentsLeftSpinBox_valueChanged(
int i )
376 disconnectUpdateSignal();
377 mScalebar->setNumberOfSegmentsLeft( i );
379 connectUpdateSignal();
380 mScalebar->endCommand();
383void QgsLayoutScaleBarWidget::mNumberOfSegmentsSpinBox_valueChanged(
int i )
391 disconnectUpdateSignal();
392 mScalebar->setNumberOfSegments( i );
394 connectUpdateSignal();
395 mScalebar->endCommand();
398void QgsLayoutScaleBarWidget::mHeightSpinBox_valueChanged(
double d )
405 disconnectUpdateSignal();
406 mScalebar->setHeight( d );
408 connectUpdateSignal();
409 mScalebar->endCommand();
412void QgsLayoutScaleBarWidget::mNumberOfSubdivisionsSpinBox_valueChanged(
int i )
420 disconnectUpdateSignal();
421 mScalebar->setNumberOfSubdivisions( i );
423 connectUpdateSignal();
424 mScalebar->endCommand();
427void QgsLayoutScaleBarWidget::mSubdivisionsHeightSpinBox_valueChanged(
double d )
434 disconnectUpdateSignal();
435 mScalebar->setSubdivisionsHeight( d );
437 connectUpdateSignal();
438 mScalebar->endCommand();
441void QgsLayoutScaleBarWidget::textFormatChanged()
448 mScalebar->beginCommand( tr(
"Set Scalebar Font" ) );
449 disconnectUpdateSignal();
450 mScalebar->setTextFormat( mFontButton->textFormat() );
451 connectUpdateSignal();
452 mScalebar->endCommand();
456void QgsLayoutScaleBarWidget::changeNumberFormat()
465 widget->
setFormat( mScalebar->numericFormat() );
468 mScalebar->beginCommand( tr(
"Set Scalebar Number Format" ) );
469 disconnectUpdateSignal();
470 mScalebar->setNumericFormat( widget->
format() );
471 connectUpdateSignal();
472 mScalebar->endCommand();
479void QgsLayoutScaleBarWidget::mUnitLabelLineEdit_textChanged(
const QString &text )
487 disconnectUpdateSignal();
488 mScalebar->setUnitLabel( text );
490 connectUpdateSignal();
491 mScalebar->endCommand();
494void QgsLayoutScaleBarWidget::mMapUnitsPerBarUnitSpinBox_valueChanged(
double d )
502 disconnectUpdateSignal();
503 mScalebar->setMapUnitsPerScaleBarUnit( d );
505 connectUpdateSignal();
506 mScalebar->endCommand();
509void QgsLayoutScaleBarWidget::mStyleComboBox_currentIndexChanged(
const QString & )
516 const QString rendererId = mStyleComboBox->currentData().toString();
517 if ( rendererId == mScalebar->style() )
520 mScalebar->beginCommand( tr(
"Set Scalebar Style" ) );
521 disconnectUpdateSignal();
523 bool defaultsApplied =
false;
526 defaultsApplied = mScalebar->applyDefaultRendererSettings( renderer.get() );
529 toggleStyleSpecificControls( rendererId );
531 mScalebar->setStyle( rendererId );
533 connectUpdateSignal();
534 mScalebar->endCommand();
536 if ( defaultsApplied )
540void QgsLayoutScaleBarWidget::toggleStyleSpecificControls(
const QString &style )
556 if ( !mGroupBoxUnits->isEnabled() )
557 mGroupBoxSegments->setCollapsed(
true );
578void QgsLayoutScaleBarWidget::mLabelBarSpaceSpinBox_valueChanged(
double d )
586 disconnectUpdateSignal();
587 mScalebar->setLabelBarSpace( d );
589 connectUpdateSignal();
590 mScalebar->endCommand();
593void QgsLayoutScaleBarWidget::mBoxSizeSpinBox_valueChanged(
double d )
601 disconnectUpdateSignal();
602 mScalebar->setBoxContentSpace( d );
604 connectUpdateSignal();
605 mScalebar->endCommand();
608void QgsLayoutScaleBarWidget::mLabelVerticalPlacementComboBox_currentIndexChanged(
int index )
615 mScalebar->beginCommand( tr(
"Set Scalebar Label Vertical Placement" ) );
616 disconnectUpdateSignal();
619 connectUpdateSignal();
620 mScalebar->endCommand();
623void QgsLayoutScaleBarWidget::mLabelHorizontalPlacementComboBox_currentIndexChanged(
int index )
630 mScalebar->beginCommand( tr(
"Set Scalebar Label Horizontal Placement" ) );
631 disconnectUpdateSignal();
634 connectUpdateSignal();
635 mScalebar->endCommand();
638void QgsLayoutScaleBarWidget::alignmentChanged()
645 mScalebar->beginCommand( tr(
"Set Scalebar Alignment" ) );
646 disconnectUpdateSignal();
650 mScalebar->setAlignment( a );
652 connectUpdateSignal();
653 mScalebar->endCommand();
656void QgsLayoutScaleBarWidget::mUnitsComboBox_currentIndexChanged(
int index )
663 const QVariant unitData = mUnitsComboBox->itemData( index );
664 if ( unitData.type() == QVariant::Invalid )
669 disconnectUpdateSignal();
670 mScalebar->beginCommand( tr(
"Set Scalebar Units" ) );
674 mNumberOfSegmentsSpinBox->setValue( mScalebar->numberOfSegments() );
675 mSegmentsLeftSpinBox->setValue( mScalebar->numberOfSegmentsLeft() );
676 mUnitLabelLineEdit->setText( mScalebar->unitLabel() );
677 mSegmentSizeSpinBox->setValue( mScalebar->unitsPerSegment() );
678 mMapUnitsPerBarUnitSpinBox->setValue( mScalebar->mapUnitsPerScaleBarUnit() );
680 connectUpdateSignal();
681 mScalebar->endCommand();
684void QgsLayoutScaleBarWidget::blockMemberSignals(
bool block )
686 mSegmentSizeSpinBox->blockSignals( block );
687 mNumberOfSegmentsSpinBox->blockSignals( block );
688 mSegmentsLeftSpinBox->blockSignals( block );
689 mNumberOfSubdivisionsSpinBox->blockSignals( block );
690 mSubdivisionsHeightSpinBox->blockSignals( block );
691 mStyleComboBox->blockSignals( block );
692 mUnitLabelLineEdit->blockSignals( block );
693 mMapUnitsPerBarUnitSpinBox->blockSignals( block );
694 mHeightSpinBox->blockSignals( block );
695 mLineStyleButton->blockSignals( block );
696 mDivisionStyleButton->blockSignals( block );
697 mSubdivisionStyleButton->blockSignals( block );
698 mLabelBarSpaceSpinBox->blockSignals( block );
699 mBoxSizeSpinBox->blockSignals( block );
700 mLabelVerticalPlacementComboBox->blockSignals( block );
701 mLabelHorizontalPlacementComboBox->blockSignals( block );
702 mAlignmentComboBox->blockSignals( block );
703 mUnitsComboBox->blockSignals( block );
704 mFillSymbol1Button->blockSignals( block );
705 mFillSymbol2Button->blockSignals( block );
706 mSegmentSizeRadioGroup.blockSignals( block );
707 mMapItemComboBox->blockSignals( block );
708 mFontButton->blockSignals( block );
709 mMinWidthSpinBox->blockSignals( block );
710 mMaxWidthSpinBox->blockSignals( block );
713void QgsLayoutScaleBarWidget::connectUpdateSignal()
721void QgsLayoutScaleBarWidget::disconnectUpdateSignal()
729void QgsLayoutScaleBarWidget::segmentSizeRadioChanged( QAbstractButton *radio )
731 const bool fixedSizeMode = radio == mFixedSizeRadio;
732 mMinWidthSpinBox->setEnabled( !fixedSizeMode );
733 mMaxWidthSpinBox->setEnabled( !fixedSizeMode );
734 mSegmentSizeSpinBox->setEnabled( fixedSizeMode );
742 disconnectUpdateSignal();
743 if ( mFixedSizeRadio->isChecked() )
746 mScalebar->setUnitsPerSegment( mSegmentSizeSpinBox->value() );
753 connectUpdateSignal();
754 mScalebar->endCommand();
757void QgsLayoutScaleBarWidget::mapChanged(
QgsLayoutItem *item )
766 mScalebar->beginCommand( tr(
"Set Scalebar Map" ) );
767 disconnectUpdateSignal();
768 mScalebar->setLinkedMap( map );
770 connectUpdateSignal();
771 mScalebar->endCommand();
774void QgsLayoutScaleBarWidget::mMinWidthSpinBox_valueChanged(
double )
782 disconnectUpdateSignal();
783 mScalebar->setMinimumBarWidth( mMinWidthSpinBox->value() );
785 connectUpdateSignal();
786 mScalebar->endCommand();
789void QgsLayoutScaleBarWidget::mMaxWidthSpinBox_valueChanged(
double )
797 disconnectUpdateSignal();
798 mScalebar->setMaximumBarWidth( mMaxWidthSpinBox->value() );
800 connectUpdateSignal();
801 mScalebar->endCommand();
804void QgsLayoutScaleBarWidget::populateDataDefinedButtons()
DistanceUnit
Units of distance.
void changed()
Emitted when the alignment is changed.
static QgsScaleBarRendererRegistry * scaleBarRendererRegistry()
Gets the registry of available scalebar renderers.
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.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
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.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
void itemChanged(QgsLayoutItem *item)
Emitted whenever the currently selected item changes.
Layout graphical items for displaying a map.
@ LayoutScaleBar
Scale bar item.
A layout item subclass for scale bars.
Base class for graphical items within a QgsLayout.
@ UndoScaleBarSubdivisionsHeight
Scalebar subdivisions height.
@ UndoScaleBarLabelBarSize
Scalebar label bar size.
@ UndoScaleBarMapUnitsSegment
Scalebar map units per segment.
@ UndoScaleBarBoxContentSpace
Scalebar box context space.
@ UndoScaleBarSegmentSize
Scalebar segment size.
@ UndoScaleBarHeight
Scalebar height.
@ UndoScaleBarSegments
Scalebar number of segments.
@ UndoScaleBarSubdivisions
Scalebar number of subdivisions.
@ UndoShapeStyle
Shape symbol style.
@ UndoScaleBarSegmentsLeft
Scalebar segments left.
@ UndoScaleBarUnitText
Scalebar unit text.
int type() const override
Returns a unique graphics item type identifier.
void changed()
Emitted when the object's properties change.
@ ScalebarMinimumWidth
Scalebar segment minimum width (since QGIS 3.26)
@ ScalebarSegmentWidth
Scalebar width in map units of a single segment (since QGIS 3.26)
@ ScalebarMaximumWidth
Scalebar segment maximum width (since QGIS 3.26)
@ ScalebarHeight
Scalebar height (since QGIS 3.26)
@ ScalebarRightSegments
Number of segments on the right of 0 (since QGIS 3.26)
@ ScalebarSubdivisionHeight
Scalebar subdivision height (since QGIS 3.26)
@ ScalebarRightSegmentSubdivisions
Number of subdivisions per segment on right of 0 (since QGIS 3.26)
@ ScalebarLeftSegments
Number of segments on the left of 0 (since QGIS 3.26)
void layerChanged(QgsVectorLayer *layer)
Emitted when the context's layer is changed.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
A line symbol type, for rendering LineString and MultiLineString geometries.
Interface for master layout type objects, such as print layouts and reports.
QStringList sortedRendererList() const
Returns a list of the renderer ids currently contained in the registry, sorted in an order respecting...
@ FlagUsesLabelVerticalPlacement
Renderer uses the QgsScaleBarSettings::labelVerticalPlacement() setting.
@ FlagUsesLabelHorizontalPlacement
Renderer uses the QgsScaleBarSettings::labelHorizontalPlacement() setting.
@ FlagUsesLineSymbol
Renderer utilizes the scalebar line symbol (see QgsScaleBarSettings::lineSymbol() )
@ FlagUsesUnitLabel
Renderer uses the QgsScaleBarSettings::unitLabel() setting.
@ FlagUsesSubdivisionsHeight
Renderer uses the scalebar subdivisions height (see QgsScaleBarSettings::subdivisionsHeight() )
@ FlagUsesSubdivisionSymbol
Renderer utilizes the scalebar subdivision symbol (see QgsScaleBarSettings::subdivisionLineSymbol() )
@ FlagUsesSegments
Renderer uses the scalebar segments.
@ FlagUsesLabelBarSpace
Renderer uses the QgsScaleBarSettings::labelBarSpace() setting.
@ FlagUsesAlignment
Renderer uses the QgsScaleBarSettings::alignment() setting.
@ FlagUsesFillSymbol
Renderer utilizes the scalebar fill symbol (see QgsScaleBarSettings::fillSymbol() )
@ FlagRespectsMapUnitsPerScaleBarUnit
Renderer respects the QgsScaleBarSettings::mapUnitsPerScaleBarUnit() setting.
@ FlagRespectsUnits
Renderer respects the QgsScaleBarSettings::units() setting.
@ FlagUsesAlternateFillSymbol
Renderer utilizes the alternate scalebar fill symbol (see QgsScaleBarSettings::alternateFillSymbol() ...
@ FlagUsesSubdivisions
Renderer uses the scalebar subdivisions (see QgsScaleBarSettings::numberOfSubdivisions() )
@ FlagUsesDivisionSymbol
Renderer utilizes the scalebar division symbol (see QgsScaleBarSettings::divisionLineSymbol() )
Alignment
Scalebar alignment.
@ AlignMiddle
Center aligned.
@ AlignRight
Right aligned.
LabelHorizontalPlacement
Label horizontal placement.
@ LabelCenteredSegment
Labels are drawn centered relative to segment.
@ LabelCenteredEdge
Labels are drawn centered relative to segment's edge.
LabelVerticalPlacement
Label vertical placement.
@ LabelAboveSegment
Labels are drawn above the scalebar.
@ LabelBelowSegment
Labels are drawn below the scalebar.
@ SegmentSizeFitWidth
Scale bar segment size is calculated to fit a size range.
@ SegmentSizeFixed
Scale bar segment size is fixed to a map unit.
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.