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 ) );
126 connect( mSubdivisionStyleButton, &
QgsSymbolButton::changed,
this, &QgsLayoutScaleBarWidget::subdivisionSymbolChanged );
134 mFontButton->setDialogTitle( tr(
"Scalebar Font" ) );
139 QgsLayout *scaleBarLayout = mScalebar->layout();
140 if ( scaleBarLayout )
142 mMapItemComboBox->setCurrentLayout( scaleBarLayout );
149 blockMemberSignals(
false );
152 mLineStyleButton->registerExpressionContextGenerator( mScalebar );
154 mDivisionStyleButton->registerExpressionContextGenerator( mScalebar );
156 mSubdivisionStyleButton->registerExpressionContextGenerator( mScalebar );
158 mFillSymbol1Button->registerExpressionContextGenerator( mScalebar );
160 mFillSymbol2Button->registerExpressionContextGenerator( mScalebar );
165 if ( mScalebar->layout() )
178 if ( mItemPropertiesWidget )
197 disconnectUpdateSignal();
199 mScalebar = qobject_cast< QgsLayoutItemScaleBar * >( item );
200 mItemPropertiesWidget->
setItem( mScalebar );
204 connectUpdateSignal();
205 mFillSymbol1Button->registerExpressionContextGenerator( mScalebar );
206 mFillSymbol2Button->registerExpressionContextGenerator( mScalebar );
207 mLineStyleButton->registerExpressionContextGenerator( mScalebar );
208 mDivisionStyleButton->registerExpressionContextGenerator( mScalebar );
209 mSubdivisionStyleButton->registerExpressionContextGenerator( mScalebar );
217void QgsLayoutScaleBarWidget::lineSymbolChanged()
223 mScalebar->setLineSymbol( mLineStyleButton->clonedSymbol<
QgsLineSymbol>() );
225 mScalebar->layout()->undoStack()->endCommand();
228void QgsLayoutScaleBarWidget::divisionSymbolChanged()
234 mScalebar->setDivisionLineSymbol( mDivisionStyleButton->clonedSymbol<
QgsLineSymbol>() );
236 mScalebar->layout()->undoStack()->endCommand();
239void QgsLayoutScaleBarWidget::subdivisionSymbolChanged()
245 mScalebar->setSubdivisionLineSymbol( mSubdivisionStyleButton->clonedSymbol<
QgsLineSymbol>() );
247 mScalebar->layout()->undoStack()->endCommand();
250void QgsLayoutScaleBarWidget::fillSymbol1Changed()
256 mScalebar->setFillSymbol( mFillSymbol1Button->clonedSymbol<
QgsFillSymbol>() );
258 mScalebar->layout()->undoStack()->endCommand();
261void QgsLayoutScaleBarWidget::fillSymbol2Changed()
267 mScalebar->setAlternateFillSymbol( mFillSymbol2Button->clonedSymbol<
QgsFillSymbol>() );
269 mScalebar->layout()->undoStack()->endCommand();
272void QgsLayoutScaleBarWidget::setGuiElements()
279 blockMemberSignals(
true );
280 mNumberOfSegmentsSpinBox->setValue( mScalebar->numberOfSegments() );
281 mSegmentsLeftSpinBox->setValue( mScalebar->numberOfSegmentsLeft() );
282 mSegmentSizeSpinBox->setValue( mScalebar->unitsPerSegment() );
283 mHeightSpinBox->setValue( mScalebar->height() );
284 mNumberOfSubdivisionsSpinBox->setValue( mScalebar->numberOfSubdivisions() );
285 mSubdivisionsHeightSpinBox->setValue( mScalebar->subdivisionsHeight() );
286 mMapUnitsPerBarUnitSpinBox->setValue( mScalebar->mapUnitsPerScaleBarUnit() );
287 mLabelBarSpaceSpinBox->setValue( mScalebar->labelBarSpace() );
288 mBoxSizeSpinBox->setValue( mScalebar->boxContentSpace() );
289 mUnitLabelLineEdit->setText( mScalebar->unitLabel() );
290 mFontButton->setTextFormat( mScalebar->textFormat() );
292 whileBlocking( mLineStyleButton )->setSymbol( mScalebar->lineSymbol()->clone() );
293 whileBlocking( mDivisionStyleButton )->setSymbol( mScalebar->divisionLineSymbol()->clone() );
294 whileBlocking( mSubdivisionStyleButton )->setSymbol( mScalebar->subdivisionLineSymbol()->clone() );
295 whileBlocking( mFillSymbol1Button )->setSymbol( mScalebar->fillSymbol()->clone() );
296 whileBlocking( mFillSymbol2Button )->setSymbol( mScalebar->alternateFillSymbol()->clone() );
299 mMapItemComboBox->setItem( mScalebar->linkedMap() );
302 const QString style = mScalebar->style();
303 mStyleComboBox->setCurrentIndex( mStyleComboBox->findData( style ) );
304 toggleStyleSpecificControls( style );
307 mLabelVerticalPlacementComboBox->setCurrentIndex( mLabelVerticalPlacementComboBox->findData(
static_cast< int >( mScalebar->labelVerticalPlacement() ) ) );
308 mLabelHorizontalPlacementComboBox->setCurrentIndex( mLabelHorizontalPlacementComboBox->findData(
static_cast< int >( mScalebar->labelHorizontalPlacement() ) ) );
312 Qt::Alignment a = Qt::AlignLeft;
313 switch ( mScalebar->alignment() )
322 a = Qt::AlignHCenter;
325 mAlignmentComboBox->setCurrentAlignment( a );
328 mUnitsComboBox->setCurrentIndex( mUnitsComboBox->findData(
static_cast< int >( mScalebar->units() ) ) );
332 mFixedSizeRadio->setChecked(
true );
333 mSegmentSizeSpinBox->setEnabled(
true );
334 mMinWidthSpinBox->setEnabled(
false );
335 mMaxWidthSpinBox->setEnabled(
false );
339 mFitWidthRadio->setChecked(
true );
340 mSegmentSizeSpinBox->setEnabled(
false );
341 mMinWidthSpinBox->setEnabled(
true );
342 mMaxWidthSpinBox->setEnabled(
true );
344 mMinWidthSpinBox->setValue( mScalebar->minimumBarWidth() );
345 mMaxWidthSpinBox->setValue( mScalebar->maximumBarWidth() );
347 populateDataDefinedButtons();
349 blockMemberSignals(
false );
354void QgsLayoutScaleBarWidget::mSegmentSizeSpinBox_valueChanged(
double d )
362 disconnectUpdateSignal();
363 mScalebar->setUnitsPerSegment( d );
365 connectUpdateSignal();
366 mScalebar->endCommand();
369void QgsLayoutScaleBarWidget::mSegmentsLeftSpinBox_valueChanged(
int i )
377 disconnectUpdateSignal();
378 mScalebar->setNumberOfSegmentsLeft( i );
380 connectUpdateSignal();
381 mScalebar->endCommand();
384void QgsLayoutScaleBarWidget::mNumberOfSegmentsSpinBox_valueChanged(
int i )
392 disconnectUpdateSignal();
393 mScalebar->setNumberOfSegments( i );
395 connectUpdateSignal();
396 mScalebar->endCommand();
399void QgsLayoutScaleBarWidget::mHeightSpinBox_valueChanged(
double d )
406 disconnectUpdateSignal();
407 mScalebar->setHeight( d );
409 connectUpdateSignal();
410 mScalebar->endCommand();
413void QgsLayoutScaleBarWidget::mNumberOfSubdivisionsSpinBox_valueChanged(
int i )
421 disconnectUpdateSignal();
422 mScalebar->setNumberOfSubdivisions( i );
424 connectUpdateSignal();
425 mScalebar->endCommand();
428void QgsLayoutScaleBarWidget::mSubdivisionsHeightSpinBox_valueChanged(
double d )
435 disconnectUpdateSignal();
436 mScalebar->setSubdivisionsHeight( d );
438 connectUpdateSignal();
439 mScalebar->endCommand();
442void QgsLayoutScaleBarWidget::textFormatChanged()
449 mScalebar->beginCommand( tr(
"Set Scalebar Font" ) );
450 disconnectUpdateSignal();
451 mScalebar->setTextFormat( mFontButton->textFormat() );
452 connectUpdateSignal();
453 mScalebar->endCommand();
457void QgsLayoutScaleBarWidget::changeNumberFormat()
466 widget->
setFormat( mScalebar->numericFormat() );
469 mScalebar->beginCommand( tr(
"Set Scalebar Number Format" ) );
470 disconnectUpdateSignal();
471 mScalebar->setNumericFormat( widget->
format() );
472 connectUpdateSignal();
473 mScalebar->endCommand();
480void QgsLayoutScaleBarWidget::mUnitLabelLineEdit_textChanged(
const QString &text )
488 disconnectUpdateSignal();
489 mScalebar->setUnitLabel( text );
491 connectUpdateSignal();
492 mScalebar->endCommand();
495void QgsLayoutScaleBarWidget::mMapUnitsPerBarUnitSpinBox_valueChanged(
double d )
503 disconnectUpdateSignal();
504 mScalebar->setMapUnitsPerScaleBarUnit( d );
506 connectUpdateSignal();
507 mScalebar->endCommand();
510void QgsLayoutScaleBarWidget::mStyleComboBox_currentIndexChanged(
const QString & )
517 const QString rendererId = mStyleComboBox->currentData().toString();
518 if ( rendererId == mScalebar->style() )
521 mScalebar->beginCommand( tr(
"Set Scalebar Style" ) );
522 disconnectUpdateSignal();
524 bool defaultsApplied =
false;
527 defaultsApplied = mScalebar->applyDefaultRendererSettings( renderer.get() );
530 toggleStyleSpecificControls( rendererId );
532 mScalebar->setStyle( rendererId );
534 connectUpdateSignal();
535 mScalebar->endCommand();
537 if ( defaultsApplied )
541void QgsLayoutScaleBarWidget::toggleStyleSpecificControls(
const QString &style )
557 if ( !mGroupBoxUnits->isEnabled() )
558 mGroupBoxSegments->setCollapsed(
true );
579void QgsLayoutScaleBarWidget::mLabelBarSpaceSpinBox_valueChanged(
double d )
587 disconnectUpdateSignal();
588 mScalebar->setLabelBarSpace( d );
590 connectUpdateSignal();
591 mScalebar->endCommand();
594void QgsLayoutScaleBarWidget::mBoxSizeSpinBox_valueChanged(
double d )
602 disconnectUpdateSignal();
603 mScalebar->setBoxContentSpace( d );
605 connectUpdateSignal();
606 mScalebar->endCommand();
609void QgsLayoutScaleBarWidget::mLabelVerticalPlacementComboBox_currentIndexChanged(
int index )
616 mScalebar->beginCommand( tr(
"Set Scalebar Label Vertical Placement" ) );
617 disconnectUpdateSignal();
620 connectUpdateSignal();
621 mScalebar->endCommand();
624void QgsLayoutScaleBarWidget::mLabelHorizontalPlacementComboBox_currentIndexChanged(
int index )
631 mScalebar->beginCommand( tr(
"Set Scalebar Label Horizontal Placement" ) );
632 disconnectUpdateSignal();
635 connectUpdateSignal();
636 mScalebar->endCommand();
639void QgsLayoutScaleBarWidget::alignmentChanged()
646 mScalebar->beginCommand( tr(
"Set Scalebar Alignment" ) );
647 disconnectUpdateSignal();
651 mScalebar->setAlignment( a );
653 connectUpdateSignal();
654 mScalebar->endCommand();
657void QgsLayoutScaleBarWidget::mUnitsComboBox_currentIndexChanged(
int index )
664 const QVariant unitData = mUnitsComboBox->itemData( index );
665 if ( unitData.type() == QVariant::Invalid )
670 disconnectUpdateSignal();
671 mScalebar->beginCommand( tr(
"Set Scalebar Units" ) );
675 mNumberOfSegmentsSpinBox->setValue( mScalebar->numberOfSegments() );
676 mSegmentsLeftSpinBox->setValue( mScalebar->numberOfSegmentsLeft() );
677 mUnitLabelLineEdit->setText( mScalebar->unitLabel() );
678 mSegmentSizeSpinBox->setValue( mScalebar->unitsPerSegment() );
679 mMapUnitsPerBarUnitSpinBox->setValue( mScalebar->mapUnitsPerScaleBarUnit() );
681 connectUpdateSignal();
682 mScalebar->endCommand();
685void QgsLayoutScaleBarWidget::blockMemberSignals(
bool block )
687 mSegmentSizeSpinBox->blockSignals( block );
688 mNumberOfSegmentsSpinBox->blockSignals( block );
689 mSegmentsLeftSpinBox->blockSignals( block );
690 mNumberOfSubdivisionsSpinBox->blockSignals( block );
691 mSubdivisionsHeightSpinBox->blockSignals( block );
692 mStyleComboBox->blockSignals( block );
693 mUnitLabelLineEdit->blockSignals( block );
694 mMapUnitsPerBarUnitSpinBox->blockSignals( block );
695 mHeightSpinBox->blockSignals( block );
696 mLineStyleButton->blockSignals( block );
697 mDivisionStyleButton->blockSignals( block );
698 mSubdivisionStyleButton->blockSignals( block );
699 mLabelBarSpaceSpinBox->blockSignals( block );
700 mBoxSizeSpinBox->blockSignals( block );
701 mLabelVerticalPlacementComboBox->blockSignals( block );
702 mLabelHorizontalPlacementComboBox->blockSignals( block );
703 mAlignmentComboBox->blockSignals( block );
704 mUnitsComboBox->blockSignals( block );
705 mFillSymbol1Button->blockSignals( block );
706 mFillSymbol2Button->blockSignals( block );
707 mSegmentSizeRadioGroup.blockSignals( block );
708 mMapItemComboBox->blockSignals( block );
709 mFontButton->blockSignals( block );
710 mMinWidthSpinBox->blockSignals( block );
711 mMaxWidthSpinBox->blockSignals( block );
714void QgsLayoutScaleBarWidget::connectUpdateSignal()
722void QgsLayoutScaleBarWidget::disconnectUpdateSignal()
730void QgsLayoutScaleBarWidget::segmentSizeRadioChanged( QAbstractButton *radio )
732 const bool fixedSizeMode = radio == mFixedSizeRadio;
733 mMinWidthSpinBox->setEnabled( !fixedSizeMode );
734 mMaxWidthSpinBox->setEnabled( !fixedSizeMode );
735 mSegmentSizeSpinBox->setEnabled( fixedSizeMode );
743 disconnectUpdateSignal();
744 if ( mFixedSizeRadio->isChecked() )
747 mScalebar->setUnitsPerSegment( mSegmentSizeSpinBox->value() );
754 connectUpdateSignal();
755 mScalebar->endCommand();
758void QgsLayoutScaleBarWidget::mapChanged(
QgsLayoutItem *item )
767 mScalebar->beginCommand( tr(
"Set Scalebar Map" ) );
768 disconnectUpdateSignal();
769 mScalebar->setLinkedMap( map );
771 connectUpdateSignal();
772 mScalebar->endCommand();
775void QgsLayoutScaleBarWidget::mMinWidthSpinBox_valueChanged(
double )
783 disconnectUpdateSignal();
784 mScalebar->setMinimumBarWidth( mMinWidthSpinBox->value() );
786 connectUpdateSignal();
787 mScalebar->endCommand();
790void QgsLayoutScaleBarWidget::mMaxWidthSpinBox_valueChanged(
double )
798 disconnectUpdateSignal();
799 mScalebar->setMaximumBarWidth( mMaxWidthSpinBox->value() );
801 connectUpdateSignal();
802 mScalebar->endCommand();
805void QgsLayoutScaleBarWidget::populateDataDefinedButtons()
DistanceUnit
Units of distance.
@ Inches
Inches (since QGIS 3.32)
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.