50#include <QButtonGroup>
54#include "moc_qgstextformatwidget.cpp"
56using namespace Qt::StringLiterals;
64 setWidgetMode(
Text );
78 setWidgetMode( mode );
81void QgsTextFormatWidget::initWidget()
85 mGeometryGeneratorGroupBox->setCollapsed(
true );
87 mTextItem =
new QListWidgetItem( tr(
"Text" ), mLabelingOptionsListWidget );
89 mTextItem->setToolTip( tr(
"Text style" ) );
91 mFormattingItem =
new QListWidgetItem( tr(
"Formatting" ), mLabelingOptionsListWidget );
95 mBufferItem =
new QListWidgetItem( tr(
"Buffer" ), mLabelingOptionsListWidget );
99 mMaskItem =
new QListWidgetItem( tr(
"Mask" ), mLabelingOptionsListWidget );
103 mBackgroundItem =
new QListWidgetItem( tr(
"Background" ), mLabelingOptionsListWidget );
107 mShadowItem =
new QListWidgetItem( tr(
"Shadow" ), mLabelingOptionsListWidget );
111 mCalloutItem =
new QListWidgetItem( tr(
"Callouts" ), mLabelingOptionsListWidget );
115 mPlacementItem =
new QListWidgetItem( tr(
"Placement" ), mLabelingOptionsListWidget );
119 mRenderingItem =
new QListWidgetItem( tr(
"Rendering" ), mLabelingOptionsListWidget );
123#if ( GEOS_VERSION_MAJOR == 3 && GEOS_VERSION_MINOR < 10 )
124 mDuplicatesStackedWidget->setCurrentWidget( mDuplicatesNotAvailableWidget );
125 mLabelSpacingStackedWidget->setCurrentWidget( mLabelSpacingNotAvailableWidget );
128 mLabelingOptionsListWidget->addItem(
mTextItem );
130 mLabelingOptionsListWidget->addItem(
mBufferItem );
131 mLabelingOptionsListWidget->addItem(
mMaskItem );
133 mLabelingOptionsListWidget->addItem(
mShadowItem );
138 QObject::connect( mOptionsTab, &QTabWidget::currentChanged,
this, [
this](
int index ) {
139 if ( index == mOptionsTab->indexOf( textTab ) )
140 mLabelStackedWidget->setCurrentWidget( mLabelPage_Text );
141 else if ( index == mOptionsTab->indexOf( formattingTab ) )
142 mLabelStackedWidget->setCurrentWidget( mLabelPage_Formatting );
143 else if ( index == mOptionsTab->indexOf( maskTab ) )
144 mLabelStackedWidget->setCurrentWidget( mLabelPage_Mask );
145 else if ( index == mOptionsTab->indexOf( bufferTab ) )
146 mLabelStackedWidget->setCurrentWidget( mLabelPage_Buffer );
147 else if ( index == mOptionsTab->indexOf( backgroundTab ) )
148 mLabelStackedWidget->setCurrentWidget( mLabelPage_Background );
149 else if ( index == mOptionsTab->indexOf( shadowTab ) )
150 mLabelStackedWidget->setCurrentWidget( mLabelPage_Shadow );
151 else if ( index == mOptionsTab->indexOf( calloutsTab ) )
152 mLabelStackedWidget->setCurrentWidget( mLabelPage_Callouts );
153 else if ( index == mOptionsTab->indexOf( placementTab ) )
154 mLabelStackedWidget->setCurrentWidget( mLabelPage_Placement );
155 else if ( index == mOptionsTab->indexOf( renderingTab ) )
156 mLabelStackedWidget->setCurrentWidget( mLabelPage_Rendering );
159 QObject::connect( mLabelingOptionsListWidget, &QListWidget::currentRowChanged,
this, [
this](
int ) {
160 QListWidgetItem *currentItem = mLabelingOptionsListWidget->currentItem();
164 mLabelStackedWidget->setCurrentWidget( mLabelPage_Text );
166 mLabelStackedWidget->setCurrentWidget( mLabelPage_Formatting );
168 mLabelStackedWidget->setCurrentWidget( mLabelPage_Mask );
170 mLabelStackedWidget->setCurrentWidget( mLabelPage_Buffer );
172 mLabelStackedWidget->setCurrentWidget( mLabelPage_Background );
174 mLabelStackedWidget->setCurrentWidget( mLabelPage_Shadow );
176 mLabelStackedWidget->setCurrentWidget( mLabelPage_Callouts );
178 mLabelStackedWidget->setCurrentWidget( mLabelPage_Placement );
180 mLabelStackedWidget->setCurrentWidget( mLabelPage_Rendering );
183 QObject::connect( mLabelingOptionsListWidget, &QListWidget::currentRowChanged, mLabelStackedWidget, &QStackedWidget::setCurrentIndex );
185 connect( mShapeSVGPathLineEdit, &QLineEdit::textChanged,
this, &QgsTextFormatWidget::mShapeSVGPathLineEdit_textChanged );
186 connect( mFontSizeSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTextFormatWidget::mFontSizeSpinBox_valueChanged );
187 connect( mFontFamilyCmbBx, &QFontComboBox::currentFontChanged,
this, &QgsTextFormatWidget::mFontFamilyCmbBx_currentFontChanged );
188 connect( mFontStyleComboBox, &QComboBox::currentTextChanged,
this, &QgsTextFormatWidget::mFontStyleComboBox_currentIndexChanged );
189 connect( mFontUnderlineBtn, &QToolButton::toggled,
this, &QgsTextFormatWidget::mFontUnderlineBtn_toggled );
190 connect( mFontStrikethroughBtn, &QToolButton::toggled,
this, &QgsTextFormatWidget::mFontStrikethroughBtn_toggled );
191 connect( mFontWordSpacingSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTextFormatWidget::mFontWordSpacingSpinBox_valueChanged );
192 connect( mFontLetterSpacingSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTextFormatWidget::mFontLetterSpacingSpinBox_valueChanged );
194 connect( mFontMinPixelSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ),
this, &QgsTextFormatWidget::mFontMinPixelSpinBox_valueChanged );
195 connect( mFontMaxPixelSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ),
this, &QgsTextFormatWidget::mFontMaxPixelSpinBox_valueChanged );
204 connect( mShapeTypeCmbBx,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsTextFormatWidget::mShapeTypeCmbBx_currentIndexChanged );
205 connect( mShapeRotationCmbBx,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsTextFormatWidget::mShapeRotationCmbBx_currentIndexChanged );
206 connect( mShapeSVGParamsBtn, &QPushButton::clicked,
this, &QgsTextFormatWidget::mShapeSVGParamsBtn_clicked );
207 connect( mShapeSVGSelectorBtn, &QPushButton::clicked,
this, &QgsTextFormatWidget::mShapeSVGSelectorBtn_clicked );
208 connect( mPreviewTextEdit, &QLineEdit::textChanged,
this, &QgsTextFormatWidget::mPreviewTextEdit_textChanged );
209 connect( mPreviewTextBtn, &QToolButton::clicked,
this, &QgsTextFormatWidget::mPreviewTextBtn_clicked );
211 connect( mDirectSymbLeftToolBtn, &QToolButton::clicked,
this, &QgsTextFormatWidget::mDirectSymbLeftToolBtn_clicked );
212 connect( mDirectSymbRightToolBtn, &QToolButton::clicked,
this, &QgsTextFormatWidget::mDirectSymbRightToolBtn_clicked );
213 connect( chkLineOrientationDependent, &QCheckBox::toggled,
this, &QgsTextFormatWidget::chkLineOrientationDependent_toggled );
214 connect( mToolButtonConfigureSubstitutes, &QToolButton::clicked,
this, &QgsTextFormatWidget::mToolButtonConfigureSubstitutes_clicked );
215 connect( mKerningCheckBox, &QCheckBox::toggled,
this, &QgsTextFormatWidget::kerningToggled );
216 connect( mComboOverlapHandling, qOverload<int>( &QComboBox::currentIndexChanged ),
this, &QgsTextFormatWidget::overlapModeChanged );
217 connect( mTabStopsButton, &QToolButton::clicked,
this, &QgsTextFormatWidget::configureTabStops );
220 mOptionsTab->setIconSize( QSize( iconSize, iconSize ) );
221 mLabelingOptionsListWidget->setIconSize( QSize( iconSize, iconSize ) );
227 mPreviewTextBtn->setIconSize( QSize( iconSize16, iconSize16 ) );
228 mPointOffsetAboveLeft->setIconSize( QSize( iconSize32, iconSize18 ) );
229 mPointOffsetAbove->setIconSize( QSize( iconSize32, iconSize18 ) );
230 mPointOffsetAboveRight->setIconSize( QSize( iconSize32, iconSize18 ) );
231 mPointOffsetLeft->setIconSize( QSize( iconSize32, iconSize18 ) );
232 mPointOffsetOver->setIconSize( QSize( iconSize32, iconSize18 ) );
233 mPointOffsetRight->setIconSize( QSize( iconSize32, iconSize18 ) );
234 mPointOffsetBelowLeft->setIconSize( QSize( iconSize32, iconSize18 ) );
235 mPointOffsetBelow->setIconSize( QSize( iconSize32, iconSize18 ) );
236 mPointOffsetBelowRight->setIconSize( QSize( iconSize32, iconSize18 ) );
241 mFontUnderlineBtn->setMinimumSize( buttonSize, buttonSize );
242 mFontUnderlineBtn->setMaximumSize( buttonSize, buttonSize );
243 mFontStrikethroughBtn->setMinimumSize( buttonSize, buttonSize );
244 mFontStrikethroughBtn->setMaximumSize( buttonSize, buttonSize );
245 mFontBoldBtn->setMinimumSize( buttonSize, buttonSize );
246 mFontBoldBtn->setMaximumSize( buttonSize, buttonSize );
247 mFontItalicBtn->setMinimumSize( buttonSize, buttonSize );
248 mFontItalicBtn->setMaximumSize( buttonSize, buttonSize );
250 mPreviewScaleComboBox->setMapCanvas(
mMapCanvas );
251 mPreviewScaleComboBox->setShowCurrentScaleButton(
true );
254 const auto unitWidgets = findChildren<QgsUnitSelectionWidget *>();
255 for ( QgsUnitSelectionWidget *unitWidget : unitWidgets )
276 mFontLineHeightSpinBox->setClearValue( 100.0 );
277 mShapeRotationDblSpnBx->setClearValue( 0.0 );
278 mShapeOffsetXSpnBx->setClearValue( 0.0 );
279 mShapeOffsetYSpnBx->setClearValue( 0.0 );
280 mPointOffsetXSpinBox->setClearValue( 0.0 );
281 mPointOffsetYSpinBox->setClearValue( 0.0 );
282 mPointAngleSpinBox->setClearValue( 0.0 );
283 mFontLetterSpacingSpinBox->setClearValue( 0.0 );
284 mFontWordSpacingSpinBox->setClearValue( 0.0 );
285 mZIndexSpinBox->setClearValue( 0.0 );
286 mLineDistanceSpnBx->setClearValue( 0.0 );
287 mMaximumDistanceSpnBx->setMinimum( 0 );
288 mMaximumDistanceSpnBx->setClearValue( 0.0, tr(
"Not set" ) );
289 mSpinStretch->setClearValue( 100 );
290 mTabStopDistanceSpin->setMinimum( 0 );
294 mFontLineHeightSpinBox->setClearValue( 100.0 );
296 mFontLineHeightSpinBox->setClearValue( 10.0 );
320 connect( mComboCurvedLabelMode, qOverload<int>( &QComboBox::currentIndexChanged ),
this, &QgsTextFormatWidget::updateCurvedLabelDescription );
321 QFont font = mCurvedModeDescriptionLabel->font();
322 font.setItalic(
true );
323 mCurvedModeDescriptionLabel->setFont( font );
324 updateCurvedLabelDescription();
330 updateAvailableShadowPositions();
333 mBackgroundMarkerSymbolButton->setDialogTitle( tr(
"Background Symbol" ) );
334 mBackgroundMarkerSymbolButton->registerExpressionContextGenerator(
this );
335 mBackgroundMarkerSymbolButton->setMapCanvas(
mMapCanvas );
337 mBackgroundFillSymbolButton->setDialogTitle( tr(
"Background Symbol" ) );
338 mBackgroundFillSymbolButton->registerExpressionContextGenerator(
this );
339 mBackgroundFillSymbolButton->setMapCanvas(
mMapCanvas );
341 mCharDlg =
new QgsCharacterSelectorDialog(
this );
343 mRefFont = lblFontPreview->font();
346 connect( mShadowOffsetAngleDial, &QAbstractSlider::valueChanged, mShadowOffsetAngleSpnBx, &QSpinBox::setValue );
347 connect( mShadowOffsetAngleSpnBx,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ), mShadowOffsetAngleDial, &QAbstractSlider::setValue );
348 connect( mLimitLabelChkBox, &QAbstractButton::toggled, mLimitLabelSpinBox, &QWidget::setEnabled );
349 connect( mCheckBoxSubstituteText, &QAbstractButton::toggled, mToolButtonConfigureSubstitutes, &QWidget::setEnabled );
359 populateFontCapitalsComboBox();
362 mPreviewBackgroundBtn->setColorDialogTitle( tr(
"Select Fill Color" ) );
363 mPreviewBackgroundBtn->setContext( u
"labeling"_s );
364 mPreviewBackgroundBtn->setColor( QColor( 255, 255, 255 ) );
365 btnTextColor->setColorDialogTitle( tr(
"Select Text Color" ) );
366 btnTextColor->setContext( u
"labeling"_s );
367 btnTextColor->setDefaultColor( Qt::black );
368 btnBufferColor->setColorDialogTitle( tr(
"Select Buffer Color" ) );
369 btnBufferColor->setContext( u
"labeling"_s );
370 btnBufferColor->setDefaultColor( Qt::white );
371 mShapeStrokeColorBtn->setColorDialogTitle( tr(
"Select Stroke Color" ) );
372 mShapeStrokeColorBtn->setContext( u
"labeling"_s );
373 mShapeFillColorBtn->setColorDialogTitle( tr(
"Select Fill Color" ) );
374 mShapeFillColorBtn->setContext( u
"labeling"_s );
375 mShadowColorBtn->setColorDialogTitle( tr(
"Select Shadow Color" ) );
376 mShadowColorBtn->setContext( u
"labeling"_s );
377 mShadowColorBtn->setDefaultColor( Qt::black );
379 mFontColorDDBtn->registerLinkedWidget( btnTextColor );
380 mBufferColorDDBtn->registerLinkedWidget( btnBufferColor );
381 mShapeStrokeColorDDBtn->registerLinkedWidget( mShapeStrokeColorBtn );
382 mShapeFillColorDDBtn->registerLinkedWidget( mShapeFillColorBtn );
383 mShadowColorDDBtn->registerLinkedWidget( mShadowColorBtn );
424 const auto groupBoxes = findChildren<QgsCollapsibleGroupBox *>();
425 for ( QgsCollapsibleGroupBox *grpbox : groupBoxes )
427 grpbox->setSettingGroup( u
"mAdvLabelingDlg"_s );
433 mLabelingOptionsListWidget->setAttribute( Qt::WA_MacShowFocusRect,
false );
435 const QgsSettings settings;
438 QSizePolicy policy( mLabelingOptionsListFrame->sizePolicy() );
439 policy.setHorizontalStretch( 0 );
440 mLabelingOptionsListFrame->setSizePolicy( policy );
441 if ( !settings.
contains( u
"/Windows/Labeling/OptionsSplitState"_s ) )
444 QList<int> splitsizes;
446 mLabelingOptionsSplitter->setSizes( splitsizes );
450 connect( mLabelStackedWidget, &QStackedWidget::currentChanged,
this, &QgsTextFormatWidget::optionsStackedWidget_CurrentChanged );
453 mFontPreviewSplitter->restoreState( settings.
value( u
"Windows/Labeling/FontPreviewSplitState"_s ).toByteArray() );
454 mLabelingOptionsSplitter->restoreState( settings.
value( u
"Windows/Labeling/OptionsSplitState"_s ).toByteArray() );
456 mLabelingOptionsListWidget->setCurrentRow( settings.
value( u
"Windows/Labeling/Tab"_s, 0 ).toInt() );
460 mBufferEffectWidget->setPaintEffect( mBufferEffect.get() );
464 mMaskEffectWidget->setPaintEffect( mMaskEffect.get() );
468 mBackgroundEffectWidget->setPaintEffect( mBackgroundEffect.get() );
470 overlapModeChanged();
472#if QT_VERSION >= QT_VERSION_CHECK( 6, 3, 0 )
475 mLabelStretch->hide();
476 mSpinStretch->hide();
477 mFontStretchDDBtn->hide();
482 QList<QWidget *> widgets;
483 widgets << btnBufferColor
485 << mComboMultipartBehavior
489 << chkLineOrientationDependent
491 << chkPreserveRotation
493 << comboBufferBlendMode
495 << mBufferJoinStyleComboBox
496 << mBufferTranspFillChbx
497 << mBufferOpacityWidget
498 << mCentroidInsideCheckBox
500 << mCoordRotationUnitComboBox
502 << mDirectSymbLeftLineEdit
503 << mDirectSymbRevChkBx
504 << mDirectSymbRightLineEdit
505 << mFitInsidePolygonCheckBox
506 << mFontCapitalsComboBox
507 << mFontLetterSpacingSpinBox
508 << mFontLimitPixelChkBox
509 << mFontLineHeightSpinBox
510 << mLineHeightUnitWidget
511 << mFontMaxPixelSpinBox
512 << mFontMinPixelSpinBox
513 << mFontMultiLineAlignComboBox
515 << mFontStyleComboBox
516 << mTextOrientationComboBox
517 << mTextOpacityWidget
519 << mFontWordSpacingSpinBox
521 << mFormatNumDecimalsSpnBx
522 << mFormatNumPlusSignChkBx
524 << mLimitLabelSpinBox
525 << mLineDistanceSpnBx
526 << mLineDistanceUnitWidget
527 << mMaximumDistanceSpnBx
528 << mMaximumDistanceUnitWidget
529 << mMaxCharAngleInDSpinBox
530 << mMaxCharAngleOutDSpinBox
532 << mOffsetTypeComboBox
533 << mCheckAllowDegradedPlacement
534 << mComboOverlapHandling
535 << mPointAngleSpinBox
536 << mPointOffsetUnitWidget
537 << mPointOffsetXSpinBox
538 << mPointOffsetYSpinBox
539 << mPreviewBackgroundBtn
542 << mRepeatDistanceSpinBox
543 << mRepeatDistanceUnitWidget
544 << mOverrunDistanceSpinBox
545 << mOverrunDistanceUnitWidget
546 << mLabelMarginSpinBox
547 << mLabelMarginUnitWidget
548 << mScaleBasedVisibilityChkBx
554 << mShadowOffsetAngleSpnBx
555 << mShadowOffsetGlobalChkBx
556 << mShadowOffsetSpnBx
557 << mShadowOffsetUnitWidget
558 << mShadowRadiusAlphaChkBx
559 << mShadowRadiusDblSpnBx
560 << mShadowRadiusUnitWidget
562 << mShadowOpacityWidget
565 << mShapeStrokeColorBtn
566 << mShapeStrokeWidthSpnBx
567 << mShapeStrokeWidthUnitWidget
569 << mShapeFillColorBtn
570 << mShapeOffsetXSpnBx
571 << mShapeOffsetYSpnBx
572 << mShapeOffsetUnitWidget
573 << mShapeRadiusXDbSpnBx
574 << mShapeRadiusYDbSpnBx
575 << mShapeRotationCmbBx
576 << mShapeRotationDblSpnBx
577 << mShapeRadiusUnitWidget
578 << mShapeSVGPathLineEdit
580 << mShapeSizeUnitWidget
583 << mBackgroundOpacityWidget
588 << mAutoWrapLengthSpinBox
589 << mAutoWrapTypeComboBox
590 << mCentroidRadioVisible
591 << mCentroidRadioWhole
592 << mDirectSymbRadioBtnAbove
593 << mDirectSymbRadioBtnBelow
594 << mDirectSymbRadioBtnLR
595 << mUpsidedownRadioAll
596 << mUpsidedownRadioDefined
597 << mUpsidedownRadioOff
598 << mPlacementModeComboBox
599 << mFieldExpressionWidget
600 << mCheckBoxSubstituteText
601 << mGeometryGeneratorGroupBox
602 << mGeometryGenerator
603 << mGeometryGeneratorType
604 << mBackgroundMarkerSymbolButton
605 << mBackgroundFillSymbolButton
606 << mCalloutsDrawCheckBox
607 << mCalloutStyleComboBox
610 << mMaskJoinStyleComboBox
611 << mMaskBufferSizeSpinBox
612 << mMaskOpacityWidget
613 << mCheckAllowLabelsOutsidePolygons
614 << mHtmlFormattingCheckBox
615 << mPrioritizationComboBox
616 << mComboCurvedLabelMode
617 << mTabDistanceUnitWidget
618 << mTabStopDistanceSpin
620 << mCheckWhitespaceIsNotACollision;
622 connectValueChanged( widgets );
627 connect( mBufferDrawChkBx, &QCheckBox::stateChanged,
this, [
this](
int ) {
628 updateBufferFrameStatus();
631 connect( mShapeDrawChkBx, &QCheckBox::stateChanged,
this, [
this](
int ) {
632 updateShapeFrameStatus();
635 connect( mShadowDrawChkBx, &QCheckBox::stateChanged,
this, [
this](
int ) {
636 updateShadowFrameStatus();
639 connect( mCalloutsDrawCheckBox, &QCheckBox::stateChanged,
this, [
this](
int ) {
640 updateCalloutFrameStatus();
648 whileBlocking( mOptionsTab )->setCurrentIndex( mLabelStackedWidget->currentIndex() );
649 mOptionsTab->tabBar()->setUsesScrollButtons(
true );
654 lblFontPreview->setMapUnits(
mMapCanvas->mapSettings().mapUnits() );
655 mPreviewScaleComboBox->setScale(
mMapCanvas->mapSettings().scale() );
677 const int prevIndex = mOptionsTab->currentIndex();
687 mOptionsTab->removeTab( mOptionsTab->indexOf( renderingTab ) );
688 mOptionsTab->removeTab( mOptionsTab->indexOf( placementTab ) );
689 mOptionsTab->removeTab( mOptionsTab->indexOf( calloutsTab ) );
690 mOptionsTab->removeTab( mOptionsTab->indexOf( maskTab ) );
691 mLabelStackedWidget->removeWidget( mLabelPage_Rendering );
692 mLabelStackedWidget->removeWidget( mLabelPage_Callouts );
693 mLabelStackedWidget->removeWidget( mLabelPage_Mask );
694 mLabelStackedWidget->removeWidget( mLabelPage_Placement );
704 mLabelStackedWidget->setCurrentIndex( prevIndex - 1 );
705 mOptionsTab->setCurrentIndex( prevIndex - 1 );
712 mLabelStackedWidget->setCurrentIndex( 0 );
713 mOptionsTab->setCurrentIndex( 0 );
717 mStackedWidgetLabelWith->hide();
718 mDirectSymbolsFrame->hide();
719 mFormatNumFrame->hide();
720 mFormatNumChkBx->hide();
721 mFormatNumDDBtn->hide();
722 mCheckBoxSubstituteText->hide();
723 mToolButtonConfigureSubstitutes->hide();
724 mLabelWrapOnCharacter->hide();
725 wrapCharacterEdit->hide();
726 mWrapCharDDBtn->hide();
727 mLabelWrapLinesTo->hide();
728 mAutoWrapLengthSpinBox->hide();
729 mAutoWrapLengthDDBtn->hide();
730 mAutoWrapTypeComboBox->hide();
731 mFontMultiLineLabel->hide();
732 mFontMultiLineAlignComboBox->hide();
733 mFontMultiLineAlignDDBtn->hide();
743 const QList<QgsPropertyOverrideButton *> buttons = findChildren<QgsPropertyOverrideButton *>();
746#if QT_VERSION >= QT_VERSION_CHECK( 6, 3, 0 )
749 if ( button == mFontStretchDDBtn )
752 button->setVisible( visible );
758 mOptionsTab->setVisible( enabled );
759 if (
int tabIndex = mOptionsTab->indexOf( textTab ); tabIndex >= 0 )
760 mOptionsTab->setTabToolTip( tabIndex, tr(
"Text" ) );
761 if (
int tabIndex = mOptionsTab->indexOf( formattingTab ); tabIndex >= 0 )
762 mOptionsTab->setTabToolTip( tabIndex, tr(
"Formatting" ) );
763 if (
int tabIndex = mOptionsTab->indexOf( bufferTab ); tabIndex >= 0 )
764 mOptionsTab->setTabToolTip( tabIndex, tr(
"Buffer" ) );
765 if (
int tabIndex = mOptionsTab->indexOf( maskTab ); tabIndex >= 0 )
766 mOptionsTab->setTabToolTip( tabIndex, tr(
"Mask" ) );
767 if (
int tabIndex = mOptionsTab->indexOf( backgroundTab ); tabIndex >= 0 )
768 mOptionsTab->setTabToolTip( tabIndex, tr(
"Background" ) );
769 if (
int tabIndex = mOptionsTab->indexOf( shadowTab ); tabIndex >= 0 )
770 mOptionsTab->setTabToolTip( tabIndex, tr(
"Shadow" ) );
771 if (
int tabIndex = mOptionsTab->indexOf( calloutsTab ); tabIndex >= 0 )
772 mOptionsTab->setTabToolTip( tabIndex, tr(
"Callouts" ) );
773 if (
int tabIndex = mOptionsTab->indexOf( placementTab ); tabIndex >= 0 )
774 mOptionsTab->setTabToolTip( tabIndex, tr(
"Placement" ) );
775 if (
int tabIndex = mOptionsTab->indexOf( renderingTab ); tabIndex >= 0 )
776 mOptionsTab->setTabToolTip( tabIndex, tr(
"Rendering" ) );
778 mLabelingOptionsListFrame->setVisible( !enabled );
779 groupBox_mPreview->setVisible( !enabled );
783void QgsTextFormatWidget::connectValueChanged(
const QList<QWidget *> &widgets )
785 const auto constWidgets = widgets;
786 for ( QWidget *widget : constWidgets )
792 else if ( QgsFieldExpressionWidget *w = qobject_cast<QgsFieldExpressionWidget *>( widget ) )
796 else if ( QgsOpacityWidget *w = qobject_cast<QgsOpacityWidget *>( widget ) )
800 else if ( QgsScaleWidget *w = qobject_cast<QgsScaleWidget *>( widget ) )
804 else if ( QgsUnitSelectionWidget *w = qobject_cast<QgsUnitSelectionWidget *>( widget ) )
808 else if ( QComboBox *w = qobject_cast<QComboBox *>( widget ) )
812 else if ( QSpinBox *w = qobject_cast<QSpinBox *>( widget ) )
816 else if ( QDoubleSpinBox *w = qobject_cast<QDoubleSpinBox *>( widget ) )
820 else if ( QgsColorButton *w = qobject_cast<QgsColorButton *>( widget ) )
824 else if ( QCheckBox *w = qobject_cast<QCheckBox *>( widget ) )
828 else if ( QRadioButton *w = qobject_cast<QRadioButton *>( widget ) )
832 else if ( QLineEdit *w = qobject_cast<QLineEdit *>( widget ) )
836 else if ( QSlider *w = qobject_cast<QSlider *>( widget ) )
840 else if ( QGroupBox *w = qobject_cast<QGroupBox *>( widget ) )
844 else if ( QgsCodeEditorExpression *w = qobject_cast<QgsCodeEditorExpression *>( widget ) )
850 QgsLogger::warning( u
"Could not create connection for widget %1"_s.arg( widget->objectName() ) );
883 mDirectSymbDDBtn->registerCheckedWidget( mDirectSymbChkBx );
891 mFormatNumDDBtn->registerCheckedWidget( mFormatNumChkBx );
906 mEnableMaskDDBtn->registerCheckedWidget( mEnableMaskChkBx );
914 mShapeDrawDDBtn->registerCheckedWidget( mShapeDrawChkBx );
936 mShadowDrawDDBtn->registerCheckedWidget( mShadowDrawChkBx );
983 updateDataDefinedAlignment();
986 const QString ddScaleVisInfo = tr(
"Value < 0 represents a scale closer than 1:1, e.g. -10 = 10:1<br>"
987 "Value of 0 disables the specific limit." );
989 mScaleBasedVisibilityDDBtn->registerCheckedWidget( mScaleBasedVisibilityChkBx );
991 mScaleBasedVisibilityMinDDBtn->setUsageInfo( ddScaleVisInfo );
993 mScaleBasedVisibilityMaxDDBtn->setUsageInfo( ddScaleVisInfo );
999 mMinScaleWidget->setPredefinedScales( scales );
1000 mMaxScaleWidget->setPredefinedScales( scales );
1005 mMinScaleWidget->updateScales();
1006 mMaxScaleWidget->updateScales();
1010 mFontLimitPixelDDBtn->registerCheckedWidget( mFontLimitPixelChkBox );
1033 if ( !mButtons.contains( key ) )
1038 mButtons[key] = button;
1058 mBufferDrawChkBx->setChecked( buffer.
enabled() );
1059 mBufferFrame->setEnabled( buffer.
enabled() );
1060 spinBufferSize->setValue( buffer.
size() );
1061 mBufferUnitWidget->setUnit( buffer.
sizeUnit() );
1063 btnBufferColor->setColor( buffer.
color() );
1064 mBufferOpacityWidget->setOpacity( buffer.
opacity() );
1065 mBufferJoinStyleComboBox->setPenJoinStyle( buffer.
joinStyle() );
1067 comboBufferBlendMode->setBlendMode( buffer.
blendMode() );
1069 mBufferEffect.reset( lPaintEffect->clone() );
1073 mBufferEffect->setEnabled(
false );
1075 mBufferEffectWidget->setPaintEffect( mBufferEffect.get() );
1079 mEnableMaskChkBx->setChecked( mask.
enabled() );
1080 mMaskBufferSizeSpinBox->setValue( mask.
size() );
1081 mMaskBufferUnitWidget->setUnit( mask.
sizeUnit() );
1083 mMaskOpacityWidget->setOpacity( mask.
opacity() );
1084 mMaskJoinStyleComboBox->setPenJoinStyle( mask.
joinStyle() );
1086 mMaskEffect.reset( lPaintEffect->clone() );
1090 mMaskEffect->setEnabled(
false );
1092 mMaskEffectWidget->setPaintEffect( mMaskEffect.get() );
1094 mFontSizeUnitWidget->setUnit(
format.sizeUnit() );
1095 mFontSizeUnitWidget->setMapUnitScale(
format.sizeMapUnitScale() );
1096 mRefFont =
format.font();
1097 mFontSizeSpinBox->setValue(
format.size() );
1098 btnTextColor->setColor(
format.color() );
1100 mTextOpacityWidget->setOpacity(
format.opacity() );
1101 comboBlendMode->setBlendMode(
format.blendMode() );
1102 mTextOrientationComboBox->setCurrentIndex( mTextOrientationComboBox->findData(
static_cast<int>(
format.orientation() ) ) );
1103 mHtmlFormattingCheckBox->setChecked(
format.allowHtmlFormatting() );
1105 mFontWordSpacingSpinBox->setValue(
format.font().wordSpacing() );
1106 mFontLetterSpacingSpinBox->setValue(
format.font().letterSpacing() );
1109 mTabDistanceUnitWidget->setUnit(
format.tabStopDistanceUnit() );
1110 mTabDistanceUnitWidget->setMapUnitScale(
format.tabStopDistanceMapUnitScale() );
1113 whileBlocking( mFontCapitalsComboBox )->setCurrentIndex( mFontCapitalsComboBox->findData(
static_cast<int>(
format.capitalization() ) ) );
1115 updateFont( mRefFont );
1118 mFontMissingLabel->setVisible( !
format.fontFound() );
1119 if ( !
format.fontFound() )
1121 const QString missingTxt = tr(
"%1 not found. Default substituted." );
1122 QString txtPrepend = tr(
"Chosen font" );
1123 if ( !
format.resolvedFontFamily().isEmpty() )
1125 txtPrepend = u
"'%1'"_s.arg(
format.resolvedFontFamily() );
1127 mFontMissingLabel->setText( missingTxt.arg( txtPrepend ) );
1130 mLabelingOptionsListWidget->setCurrentItem(
mTextItem );
1131 whileBlocking( mOptionsTab )->setCurrentIndex( mOptionsTab->indexOf( textTab ) );
1134 mLineHeightUnitWidget->setUnit(
format.lineHeightUnit() );
1137 mShapeDrawChkBx->setChecked( background.
enabled() );
1138 mShapeFrame->setEnabled( background.
enabled() );
1139 mShapeTypeCmbBx->blockSignals(
true );
1140 mShapeTypeCmbBx->setCurrentIndex( mShapeTypeCmbBx->findData( background.
type() ) );
1141 mShapeTypeCmbBx->blockSignals(
false );
1142 updateAvailableShadowPositions();
1143 mShapeSVGPathLineEdit->setText( background.
svgFile() );
1145 mShapeSizeCmbBx->setCurrentIndex( background.
sizeType() );
1146 mShapeSizeXSpnBx->setValue( background.
size().width() );
1147 mShapeSizeYSpnBx->setValue( background.
size().height() );
1148 mShapeSizeUnitWidget->setUnit( background.
sizeUnit() );
1150 mShapeRotationCmbBx->setCurrentIndex( background.
rotationType() );
1153 mShapeRotationDblSpnBx->setValue( background.
rotation() );
1154 mShapeOffsetXSpnBx->setValue( background.
offset().x() );
1155 mShapeOffsetYSpnBx->setValue( background.
offset().y() );
1156 mShapeOffsetUnitWidget->setUnit( background.
offsetUnit() );
1158 mShapeRadiusXDbSpnBx->setValue( background.
radii().width() );
1159 mShapeRadiusYDbSpnBx->setValue( background.
radii().height() );
1160 mShapeRadiusUnitWidget->setUnit( background.
radiiUnit() );
1163 mShapeFillColorBtn->setColor( background.
fillColor() );
1164 mShapeStrokeColorBtn->setColor( background.
strokeColor() );
1165 mShapeStrokeWidthSpnBx->setValue( background.
strokeWidth() );
1169 mBackgroundOpacityWidget->setOpacity( background.
opacity() );
1170 mShapeBlendCmbBx->setBlendMode( background.
blendMode() );
1172 mLoadSvgParams =
false;
1173 mShapeTypeCmbBx_currentIndexChanged( background.
type() );
1175 if (
auto *lPaintEffect = background.
paintEffect() )
1176 mBackgroundEffect.reset( lPaintEffect->clone() );
1180 mBackgroundEffect->setEnabled(
false );
1182 mBackgroundEffectWidget->setPaintEffect( mBackgroundEffect.get() );
1188 mShadowDrawChkBx->setChecked( shadow.
enabled() );
1189 mShadowFrame->setEnabled( shadow.
enabled() );
1190 mShadowUnderCmbBx->setCurrentIndex( mShadowUnderCmbBx->findData( shadow.
shadowPlacement() ) );
1191 mShadowOffsetAngleSpnBx->setValue( shadow.
offsetAngle() );
1193 mShadowOffsetUnitWidget->setUnit( shadow.
offsetUnit() );
1195 mShadowOffsetGlobalChkBx->setChecked( shadow.
offsetGlobal() );
1197 mShadowRadiusDblSpnBx->setValue( shadow.
blurRadius() );
1200 mShadowRadiusAlphaChkBx->setChecked( shadow.
blurAlphaOnly() );
1201 mShadowOpacityWidget->setOpacity( shadow.
opacity() );
1202 mShadowScaleSpnBx->setValue( shadow.
scale() );
1204 mShadowColorBtn->setColor( shadow.
color() );
1205 mShadowBlendCmbBx->setBlendMode( shadow.
blendMode() );
1207 mPreviewBackgroundBtn->setColor(
format.previewBackgroundColor() );
1208 mPreviewBackgroundBtn->setDefaultColor(
format.previewBackgroundColor() );
1217 settings.
setValue( u
"Windows/Labeling/FontPreviewSplitState"_s, mFontPreviewSplitter->saveState() );
1218 settings.
setValue( u
"Windows/Labeling/OptionsSplitState"_s, mLabelingOptionsSplitter->saveState() );
1220 int prevIndex = mLabelingOptionsListWidget->currentRow();
1221 if ( mWidgetMode ==
Text )
1223 switch ( prevIndex )
1232 settings.
setValue( u
"Windows/Labeling/Tab"_s, prevIndex );
1238 format.setColor( btnTextColor->color() );
1239 format.setFont( mRefFont );
1240 format.setSize( mFontSizeSpinBox->value() );
1241 format.setNamedStyle( mFontStyleComboBox->currentText() );
1242 format.setOpacity( mTextOpacityWidget->opacity() );
1243 format.setStretchFactor( mSpinStretch->value() );
1244 format.setBlendMode( comboBlendMode->blendMode() );
1245 format.setSizeUnit( mFontSizeUnitWidget->unit() );
1246 format.setSizeMapUnitScale( mFontSizeUnitWidget->getMapUnitScale() );
1248 format.setLineHeightUnit( mLineHeightUnitWidget->unit() );
1249 format.setPreviewBackgroundColor( mPreviewBackgroundColor );
1251 format.setAllowHtmlFormatting( mHtmlFormattingCheckBox->isChecked() );
1253 format.setTabStopDistance( mTabDistanceUnitWidget->unit() ==
Qgis::RenderUnit::Percentage ? ( mTabStopDistanceSpin->value() / 100 ) : mTabStopDistanceSpin->value() );
1254 format.setTabStopDistanceUnit( mTabDistanceUnitWidget->unit() );
1255 format.setTabStopDistanceMapUnitScale( mTabDistanceUnitWidget->getMapUnitScale() );
1260 buffer.
setEnabled( mBufferDrawChkBx->isChecked() );
1261 buffer.
setSize( spinBufferSize->value() );
1262 buffer.
setColor( btnBufferColor->color() );
1263 buffer.
setOpacity( mBufferOpacityWidget->opacity() );
1266 buffer.
setJoinStyle( mBufferJoinStyleComboBox->penJoinStyle() );
1268 buffer.
setBlendMode( comboBufferBlendMode->blendMode() );
1273 format.setBuffer( buffer );
1277 mask.
setEnabled( mEnableMaskChkBx->isChecked() );
1278 mask.
setSize( mMaskBufferSizeSpinBox->value() );
1279 mask.
setOpacity( mMaskOpacityWidget->opacity() );
1280 mask.
setSizeUnit( mMaskBufferUnitWidget->unit() );
1282 mask.
setJoinStyle( mMaskJoinStyleComboBox->penJoinStyle() );
1292 background.
setEnabled( mShapeDrawChkBx->isChecked() );
1294 background.
setSvgFile( mShapeSVGPathLineEdit->text() );
1296 background.
setSize( QSizeF( mShapeSizeXSpnBx->value(), mShapeSizeYSpnBx->value() ) );
1297 background.
setSizeUnit( mShapeSizeUnitWidget->unit() );
1300 background.
setRotation( mShapeRotationDblSpnBx->value() );
1301 background.
setOffset( QPointF( mShapeOffsetXSpnBx->value(), mShapeOffsetYSpnBx->value() ) );
1304 background.
setRadii( QSizeF( mShapeRadiusXDbSpnBx->value(), mShapeRadiusYDbSpnBx->value() ) );
1305 background.
setRadiiUnit( mShapeRadiusUnitWidget->unit() );
1308 background.
setFillColor( mShapeFillColorBtn->color() );
1313 background.
setOpacity( mBackgroundOpacityWidget->opacity() );
1314 background.
setBlendMode( mShapeBlendCmbBx->blendMode() );
1321 format.setBackground( background );
1325 shadow.
setEnabled( mShadowDrawChkBx->isChecked() );
1336 shadow.
setOpacity( mShadowOpacityWidget->opacity() );
1337 shadow.
setScale( mShadowScaleSpnBx->value() );
1338 shadow.
setColor( mShadowColorBtn->color() );
1340 format.setShadow( shadow );
1342 if ( includeDataDefinedProperties )
1373 if ( mButtons.contains( key ) )
1382void QgsTextFormatWidget::optionsStackedWidget_CurrentChanged(
int )
1384 mLabelingOptionsListWidget->blockSignals(
true );
1385 QWidget *currentPage = mLabelStackedWidget->currentWidget();
1386 if ( currentPage == mLabelPage_Text )
1387 mLabelingOptionsListWidget->setCurrentItem(
mTextItem );
1388 else if ( currentPage == mLabelPage_Formatting )
1390 else if ( currentPage == mLabelPage_Mask )
1391 mLabelingOptionsListWidget->setCurrentItem(
mMaskItem );
1392 if ( currentPage == mLabelPage_Buffer )
1393 mLabelingOptionsListWidget->setCurrentItem(
mBufferItem );
1394 if ( currentPage == mLabelPage_Background )
1396 if ( currentPage == mLabelPage_Shadow )
1397 mLabelingOptionsListWidget->setCurrentItem(
mShadowItem );
1398 if ( currentPage == mLabelPage_Callouts )
1399 mLabelingOptionsListWidget->setCurrentItem(
mCalloutItem );
1400 if ( currentPage == mLabelPage_Rendering )
1402 if ( currentPage == mLabelPage_Placement )
1404 mLabelingOptionsListWidget->blockSignals(
false );
1411 if (
auto *lExpressionContext =
mContext.expressionContext() )
1413 mPreviewExpressionContext = *lExpressionContext;
1418 const auto symbolButtonWidgets = findChildren<QgsSymbolButton *>();
1421 symbolWidget->setMapCanvas(
mContext.mapCanvas() );
1422 symbolWidget->setMessageBar(
mContext.messageBar() );
1426void QgsTextFormatWidget::collapseSample(
bool collapse )
1430 QList<int> splitSizes = mFontPreviewSplitter->sizes();
1431 if ( splitSizes[0] > groupBox_mPreview->height() )
1433 const int delta = splitSizes[0] - groupBox_mPreview->height();
1434 splitSizes[0] -= delta;
1435 splitSizes[1] += delta;
1436 mFontPreviewSplitter->setSizes( splitSizes );
1441void QgsTextFormatWidget::changeTextColor(
const QColor &color )
1447void QgsTextFormatWidget::updateFont(
const QFont &newFont )
1450 if ( newFont != mRefFont )
1459 QFont symbolFont = mRefFont;
1460 symbolFont.setPointSize( font().pointSize() );
1461 mDirectSymbLeftLineEdit->setFont( symbolFont );
1462 mDirectSymbRightLineEdit->setFont( symbolFont );
1464 blockFontChangeSignals(
true );
1465 mFontFamilyCmbBx->setCurrentFont( symbolFont );
1466 populateFontStyleComboBox();
1467 mFontUnderlineBtn->setChecked( mRefFont.underline() );
1468 mFontStrikethroughBtn->setChecked( mRefFont.strikeOut() );
1469 mKerningCheckBox->setChecked( mRefFont.kerning() );
1470 blockFontChangeSignals(
false );
1478void QgsTextFormatWidget::blockFontChangeSignals(
bool blk )
1480 mFontFamilyCmbBx->blockSignals( blk );
1481 mFontStyleComboBox->blockSignals( blk );
1482 mFontCapitalsComboBox->blockSignals( blk );
1483 mFontUnderlineBtn->blockSignals( blk );
1484 mFontStrikethroughBtn->blockSignals( blk );
1485 mFontWordSpacingSpinBox->blockSignals( blk );
1486 mFontLetterSpacingSpinBox->blockSignals( blk );
1487 mKerningCheckBox->blockSignals( blk );
1502 lblFontPreview->setFormat(
format() );
1505void QgsTextFormatWidget::scrollPreview()
1507 scrollArea_mPreview->ensureVisible( 0, 0, 0, 0 );
1512 mPreviewBackgroundColor = color;
1514 scrollArea_mPreview->widget()->setStyleSheet( u
"background: rgb(%1, %2, %3);"_s.arg( QString::number( color.red() ), QString::number( color.green() ), QString::number( color.blue() ) ) );
1517void QgsTextFormatWidget::changeBufferColor(
const QColor &color )
1526 bool showLineFrame =
false;
1527 bool showCentroidFrame =
false;
1528 bool showQuadrantFrame =
false;
1529 bool showFixedQuadrantFrame =
false;
1530 bool showPlacementPriorityFrame =
false;
1531 bool showOffsetTypeFrame =
false;
1532 bool showOffsetFrame =
false;
1533 bool showDistanceFrame =
false;
1534 bool showMaximumDistanceFrame =
false;
1535 bool showPrioritizationFrame =
false;
1536 bool showRotationFrame =
false;
1537 bool showMaxCharAngleFrame =
false;
1538 bool showCurvedLabelModeFrame =
false;
1539 bool showWhitespaceCollisionFrame =
false;
1544 bool enableMultiLinesFrame =
true;
1550 showDistanceFrame =
true;
1551 showMaximumDistanceFrame =
true;
1559 showQuadrantFrame =
true;
1560 showFixedQuadrantFrame =
true;
1561 showOffsetFrame =
true;
1562 showRotationFrame =
true;
1566 showDistanceFrame =
true;
1567 showMaximumDistanceFrame =
true;
1568 showPlacementPriorityFrame =
true;
1569 showPrioritizationFrame =
true;
1570 showOffsetTypeFrame =
true;
1577 showLineFrame =
true;
1578 showDistanceFrame =
true;
1583 const bool offline = chkLineAbove->isChecked() || chkLineBelow->isChecked();
1584 chkLineOrientationDependent->setEnabled( offline );
1585 mPlacementDistanceFrame->setEnabled( offline );
1589 showMaxCharAngleFrame = isCurved;
1591 enableMultiLinesFrame = !isCurved;
1596 showDistanceFrame =
true;
1599 mPlacementLineFrame->setVisible( showLineFrame );
1600 mPlacementPolygonFrame->setVisible( showPolygonPlacementOptions );
1601 mPlacementCentroidFrame->setVisible( showCentroidFrame );
1602 mPlacementQuadrantFrame->setVisible( showQuadrantFrame );
1603 mPlacementFixedQuadrantFrame->setVisible( showFixedQuadrantFrame );
1604 mPlacementCartographicFrame->setVisible( showPlacementPriorityFrame );
1605 mPlacementOffsetFrame->setVisible( showOffsetFrame );
1606 mPlacementDistanceFrame->setVisible( showDistanceFrame );
1607 mPlacementMaximumDistanceFrame->setVisible( showMaximumDistanceFrame );
1608 mPlacementPrioritizationFrame->setVisible( showPrioritizationFrame );
1609 mPlacementOffsetTypeFrame->setVisible( showOffsetTypeFrame );
1610 mWhitespaceCollisionFrame->setVisible( showWhitespaceCollisionFrame );
1611 mPlacementRotationFrame->setVisible( showRotationFrame );
1615 mPlacementMaxCharAngleFrame->setVisible( showMaxCharAngleFrame );
1616 mCurvedLabelModeFrame->setVisible( showCurvedLabelModeFrame );
1618 mMultiLinesFrame->setEnabled( enableMultiLinesFrame );
1622 switch ( currentPlacement )
1626 helperText = tr(
"Arranges label candidates in a clockwise circle around the feature, preferring placements to the top-right of the feature." );
1628 helperText = tr(
"Arranges label candidates in a cluster around the feature's centroid, preferring placements directly over the centroid." );
1632 helperText = tr(
"Arranges label candidates directly over the feature or at a preset offset from the feature." );
1634 helperText = tr(
"Arranges label candidates directly over the feature's centroid, or at a preset offset from the centroid." );
1638 helperText = tr(
"Arranges label candidates parallel to a generalised line representing the feature. Placements which fall over straighter portions of the line are preferred." );
1640 helperText = tr(
"Arranges label candidates parallel to a generalised line representing the polygon's perimeter. Placements which fall over straighter portions of the perimeter are preferred." );
1644 helperText = tr(
"Arranges candidates following the curvature of a line feature. Placements which fall over straighter portions of the line are preferred." );
1648 helperText = tr(
"Arranges label candidates scattered throughout the polygon. Labels will always be placed horizontally, with placements further from the edges of the polygon preferred." );
1650 helperText = tr(
"Label candidates are arranged horizontally along the length of the feature." );
1654 helperText = tr(
"Arranges label candidates scattered throughout the polygon. Labels are rotated to respect the polygon's orientation, with placements further from the edges of the polygon preferred." );
1658 helperText = tr(
"Label candidates are placed in predefined positions around the features. Preference is given to positions with greatest cartographic appeal, e.g., top right and bottom right of the feature." );
1662 helperText = tr(
"Arranges candidates following the curvature of the feature's perimeter. Placements which fall over straighter portions of the perimeter are preferred." );
1666 helperText = tr(
"Label candidates are placed outside of the features, preferring placements which give greatest visual association between the label and the feature." );
1669 mPlacementModeDescriptionLabel->setText( u
"<i>%1</i>"_s.arg( helperText ) );
1672void QgsTextFormatWidget::populateFontCapitalsComboBox()
1677#if QT_VERSION >= QT_VERSION_CHECK( 6, 3, 0 )
1687void QgsTextFormatWidget::populateFontStyleComboBox()
1689 mFontStyleComboBox->clear();
1690 const QStringList styles = mFontDB.styles( mRefFont.family() );
1691 const auto constStyles = styles;
1692 for (
const QString &style : constStyles )
1694 mFontStyleComboBox->addItem( style );
1697 QString targetStyle = mFontDB.styleString( mRefFont );
1698 if ( !styles.contains( targetStyle ) )
1701 targetStyle = QFontInfo( f ).styleName();
1702 mRefFont.setStyleName( targetStyle );
1705 const int stylIndx = mFontStyleComboBox->findText( targetStyle );
1706 if ( stylIndx > -1 )
1711 mFontStyleComboBox->setCurrentIndex( curIndx );
1714void QgsTextFormatWidget::mFontSizeSpinBox_valueChanged(
double d )
1716 mRefFont.setPointSizeF( d );
1717 updateFont( mRefFont );
1720void QgsTextFormatWidget::mFontFamilyCmbBx_currentFontChanged(
const QFont &f )
1723 updateFont( mRefFont );
1726void QgsTextFormatWidget::mFontStyleComboBox_currentIndexChanged(
const QString &text )
1729 updateFont( mRefFont );
1732void QgsTextFormatWidget::mFontUnderlineBtn_toggled(
bool ckd )
1734 mRefFont.setUnderline( ckd );
1735 updateFont( mRefFont );
1738void QgsTextFormatWidget::mFontStrikethroughBtn_toggled(
bool ckd )
1740 mRefFont.setStrikeOut( ckd );
1741 updateFont( mRefFont );
1744void QgsTextFormatWidget::kerningToggled(
bool checked )
1746 mRefFont.setKerning( checked );
1747 updateFont( mRefFont );
1750void QgsTextFormatWidget::mFontWordSpacingSpinBox_valueChanged(
double spacing )
1752 mRefFont.setWordSpacing( spacing );
1753 updateFont( mRefFont );
1756void QgsTextFormatWidget::mFontLetterSpacingSpinBox_valueChanged(
double spacing )
1758 mRefFont.setLetterSpacing( QFont::AbsoluteSpacing, spacing );
1759 updateFont( mRefFont );
1762void QgsTextFormatWidget::mFontSizeUnitWidget_changed()
1767 mFontLimitPixelChkBox->setChecked(
false );
1773 mFontLimitPixelChkBox->setChecked(
true );
1775 updateFont( mRefFont );
1778void QgsTextFormatWidget::mFontMinPixelSpinBox_valueChanged(
int px )
1781 mFontMaxPixelSpinBox->setMinimum( px );
1782 mFontMaxPixelSpinBox->update();
1785void QgsTextFormatWidget::mFontMaxPixelSpinBox_valueChanged(
int px )
1788 if ( px < mFontMinPixelSpinBox->value() )
1790 mFontMaxPixelSpinBox->blockSignals(
true );
1791 mFontMaxPixelSpinBox->setValue( mFontMinPixelSpinBox->value() );
1792 mFontMaxPixelSpinBox->blockSignals(
false );
1794 mFontMaxPixelSpinBox->setMinimum( mFontMinPixelSpinBox->value() );
1797void QgsTextFormatWidget::mBufferUnitWidget_changed()
1799 updateFont( mRefFont );
1802void QgsTextFormatWidget::mMaskBufferUnitWidget_changed()
1804 updateFont( mRefFont );
1807void QgsTextFormatWidget::mCoordXDDBtn_changed()
1809 updateDataDefinedAlignment();
1812void QgsTextFormatWidget::mCoordXDDBtn_activated(
bool isActive )
1817 mCoordPointDDBtn->setActive(
false );
1820void QgsTextFormatWidget::mCoordYDDBtn_changed()
1822 updateDataDefinedAlignment();
1825void QgsTextFormatWidget::mCoordYDDBtn_activated(
bool isActive )
1830 mCoordPointDDBtn->setActive(
false );
1833void QgsTextFormatWidget::mCoordPointDDBtn_changed()
1835 updateDataDefinedAlignment();
1838void QgsTextFormatWidget::mCoordPointDDBtn_activated(
bool isActive )
1843 mCoordXDDBtn->setActive(
false );
1844 mCoordYDDBtn->setActive(
false );
1847void QgsTextFormatWidget::mShapeTypeCmbBx_currentIndexChanged(
int )
1855 showBackgroundRadius( isRect );
1857 mShapeSVGPathFrame->setVisible( isSVG );
1858 mBackgroundMarkerSymbolButton->setVisible( isMarker );
1859 mBackgroundFillSymbolButton->setVisible( !isSVG && !isMarker );
1863 mShapeSizeYLabel->setVisible( !isSVG && !isMarker );
1864 mShapeSizeYSpnBx->setVisible( !isSVG && !isMarker );
1865 mShapeSizeYDDBtn->setVisible( !isSVG && !isMarker );
1866 mShapeSizeXLabel->setText( tr(
"Size%1" ).arg( !isSVG && !isMarker ? tr(
" X" ) : QString() ) );
1869 mShapeFillColorBtn->setAllowOpacity( !isSVG );
1870 mShapeFillColorBtn->setButtonBackground();
1871 mShapeStrokeColorBtn->setAllowOpacity( !isSVG );
1872 mShapeStrokeColorBtn->setButtonBackground();
1875 mShapeFillColorLabel->setVisible( isSVG );
1876 mShapeFillColorLabel->setEnabled( isSVG );
1877 mShapeFillColorBtn->setVisible( isSVG );
1878 mShapeFillColorBtn->setEnabled( isSVG );
1879 mShapeFillColorDDBtn->setVisible( isSVG );
1880 mShapeFillColorDDBtn->setEnabled( isSVG );
1881 mShapeStrokeColorLabel->setVisible( isSVG );
1882 mShapeStrokeColorLabel->setEnabled( isSVG );
1883 mShapeStrokeColorBtn->setVisible( isSVG );
1884 mShapeStrokeColorBtn->setEnabled( isSVG );
1885 mShapeStrokeColorDDBtn->setVisible( isSVG );
1886 mShapeStrokeColorDDBtn->setEnabled( isSVG );
1887 mShapeStrokeWidthLabel->setVisible( isSVG );
1888 mShapeStrokeWidthLabel->setEnabled( isSVG );
1889 mShapeStrokeWidthSpnBx->setVisible( isSVG );
1890 mShapeStrokeWidthSpnBx->setEnabled( isSVG );
1891 mShapeStrokeWidthDDBtn->setVisible( isSVG );
1892 mShapeStrokeWidthDDBtn->setEnabled( isSVG );
1895 mShapeSVGParamsBtn->setVisible( isSVG );
1898 updateSvgWidgets( mShapeSVGPathLineEdit->text() );
1902 mShapeSVGUnitsLabel->setVisible( isSVG );
1903 mShapeStrokeWidthUnitWidget->setVisible(
false );
1904 mShapeStrokeUnitsDDBtn->setVisible(
false );
1905 mShapeStrokeUnitsDDBtn->setEnabled(
false );
1907 updateAvailableShadowPositions();
1910void QgsTextFormatWidget::mShapeSVGPathLineEdit_textChanged(
const QString &text )
1912 updateSvgWidgets( text );
1917 const int numOptionsChecked = ( chkLineAbove->isChecked() ? 1 : 0 ) + ( chkLineBelow->isChecked() ? 1 : 0 ) + ( chkLineOn->isChecked() ? 1 : 0 );
1919 if ( numOptionsChecked == 1 )
1922 chkLineAbove->setEnabled( !chkLineAbove->isChecked() );
1923 chkLineBelow->setEnabled( !chkLineBelow->isChecked() );
1924 chkLineOn->setEnabled( !chkLineOn->isChecked() );
1928 chkLineAbove->setEnabled(
true );
1929 chkLineBelow->setEnabled(
true );
1930 chkLineOn->setEnabled(
true );
1940void QgsTextFormatWidget::previewScaleChanged(
double scale )
1942 lblFontPreview->setScale( scale );
1945void QgsTextFormatWidget::updateSvgWidgets(
const QString &svgPath )
1947 if ( mShapeSVGPathLineEdit->text() != svgPath )
1949 mShapeSVGPathLineEdit->setText( svgPath );
1952 QString resolvedPath;
1953 bool validSVG =
true;
1954 if ( !svgPath.startsWith(
"base64:"_L1, Qt::CaseInsensitive ) )
1957 validSVG = QFileInfo::exists( resolvedPath );
1961 resolvedPath = svgPath;
1966 mShapeSVGPathLineEdit->setStyleSheet( !validSVG ? u
"QLineEdit{ color: rgb(225, 0, 0); }"_s : QString() );
1967 mShapeSVGPathLineEdit->setToolTip( !validSVG ? tr(
"File not found" ) : resolvedPath );
1969 QColor fill, stroke;
1970 double strokeWidth = 0.0;
1971 bool fillParam =
false, strokeParam =
false, strokeWidthParam =
false;
1977 mShapeSVGParamsBtn->setEnabled( validSVG && ( fillParam || strokeParam || strokeWidthParam ) );
1979 mShapeFillColorLabel->setEnabled( validSVG && fillParam );
1980 mShapeFillColorBtn->setEnabled( validSVG && fillParam );
1981 mShapeFillColorDDBtn->setEnabled( validSVG && fillParam );
1982 if ( mLoadSvgParams && validSVG && fillParam )
1983 mShapeFillColorBtn->setColor( fill );
1985 mShapeStrokeColorLabel->setEnabled( validSVG && strokeParam );
1986 mShapeStrokeColorBtn->setEnabled( validSVG && strokeParam );
1987 mShapeStrokeColorDDBtn->setEnabled( validSVG && strokeParam );
1988 if ( mLoadSvgParams && validSVG && strokeParam )
1989 mShapeStrokeColorBtn->setColor( stroke );
1991 mShapeStrokeWidthLabel->setEnabled( validSVG && strokeWidthParam );
1992 mShapeStrokeWidthSpnBx->setEnabled( validSVG && strokeWidthParam );
1993 mShapeStrokeWidthDDBtn->setEnabled( validSVG && strokeWidthParam );
1994 if ( mLoadSvgParams && validSVG && strokeWidthParam )
1995 mShapeStrokeWidthSpnBx->setValue( strokeWidth );
2001 mShapeSVGUnitsLabel->setEnabled( validSVG && strokeWidthParam );
2004void QgsTextFormatWidget::updateAvailableShadowPositions()
2006 if ( mShadowUnderCmbBx->count() == 0
2012 mShadowUnderCmbBx->clear();
2020 mShadowUnderCmbBx->setCurrentIndex( mShadowUnderCmbBx->findData( currentPlacement ) );
2021 if ( mShadowUnderCmbBx->currentIndex() == -1 )
2022 mShadowUnderCmbBx->setCurrentIndex( 0 );
2026void QgsTextFormatWidget::updateProperty()
2028 QgsPropertyOverrideButton *button = qobject_cast<QgsPropertyOverrideButton *>( sender() );
2034void QgsTextFormatWidget::createAuxiliaryField()
2039 QgsVectorLayer *vLayer = qobject_cast<QgsVectorLayer *>(
mLayer );
2047 QgsNewAuxiliaryLayerDialog dlg( vLayer,
this );
2055 QgsPropertyOverrideButton *button = qobject_cast<QgsPropertyOverrideButton *>( sender() );
2066 property.setActive(
true );
2075void QgsTextFormatWidget::updateShapeFrameStatus()
2077 mShapeFrame->setEnabled( mShapeDrawDDBtn->isActive() || mShapeDrawChkBx->isChecked() );
2080void QgsTextFormatWidget::updateBufferFrameStatus()
2082 mBufferFrame->setEnabled( mBufferDrawDDBtn->isActive() || mBufferDrawChkBx->isChecked() );
2085void QgsTextFormatWidget::updateShadowFrameStatus()
2087 mShadowFrame->setEnabled( mShadowDrawDDBtn->isActive() || mShadowDrawChkBx->isChecked() );
2090void QgsTextFormatWidget::updateCalloutFrameStatus()
2092 mCalloutFrame->setEnabled( mCalloutDrawDDBtn->isActive() || mCalloutsDrawCheckBox->isChecked() );
2095void QgsTextFormatWidget::updateDataDefinedAlignment()
2098 mCoordAlignmentFrame->setEnabled( ( mCoordXDDBtn->isActive() && mCoordYDDBtn->isActive() ) || mCoordPointDDBtn->isActive() );
2101void QgsTextFormatWidget::overlapModeChanged()
2103 QString description;
2107 description = tr(
"Overlapping labels will never be placed for the layer, even if it means some labels will be missing. (To see unplaced labels use the \"Show Unplaced Labels\" toolbar action.)" );
2110 description = tr(
"If a label cannot otherwise be placed for a feature then an overlapping label is permitted." );
2113 description = tr(
"Labels from this layer may freely overlap other labels or label obstacles without penalty." );
2117 mOverlapModeDescriptionLabel->setText( u
"<i>%1</i>"_s.arg( description ) );
2120void QgsTextFormatWidget::updateCurvedLabelDescription()
2125 mCurvedModeDescriptionLabel->hide();
2128 mCurvedModeDescriptionLabel->setText( tr(
"Places individual characters from the label at each corresponding vertex in the line." ) );
2129 mCurvedModeDescriptionLabel->show();
2132 mCurvedModeDescriptionLabel->setText( tr(
"Stretches (or shrinks) character spacing so that the curved label fits the whole line." ) );
2133 mCurvedModeDescriptionLabel->show();
2136 mCurvedModeDescriptionLabel->setText( tr(
"Stretches (or shrinks) word spacing so that the curved label fits the whole line." ) );
2137 mCurvedModeDescriptionLabel->show();
2144 if ( name.isEmpty() )
2187 saveDlg.
setDefaultTags( mTextFormatsListWidget->currentTagFilter() );
2188 if ( !saveDlg.exec() )
2191 if ( saveDlg.
name().isEmpty() )
2201 const int res = QMessageBox::warning(
this, tr(
"Save Text Format" ), tr(
"Format with name '%1' already exists. Overwrite?" ).arg( saveDlg.
name() ), QMessageBox::Yes | QMessageBox::No );
2202 if ( res != QMessageBox::Yes )
2209 const QStringList symbolTags = saveDlg.
tags().split(
',' );
2216void QgsTextFormatWidget::mShapeSVGSelectorBtn_clicked()
2219 svgDlg.setWindowTitle( tr(
"Select SVG file" ) );
2220 svgDlg.svgSelector()->setSvgPath( mShapeSVGPathLineEdit->text().trimmed() );
2222 if ( svgDlg.exec() == QDialog::Accepted )
2224 const QString svgPath = svgDlg.svgSelector()->currentSvgPath();
2225 if ( !svgPath.isEmpty() )
2227 mShapeSVGPathLineEdit->setText( svgPath );
2233void QgsTextFormatWidget::mShapeSVGParamsBtn_clicked()
2235 const QString svgPath = mShapeSVGPathLineEdit->text();
2236 mLoadSvgParams =
true;
2237 updateSvgWidgets( svgPath );
2238 mLoadSvgParams =
false;
2241void QgsTextFormatWidget::mShapeRotationCmbBx_currentIndexChanged(
int index )
2247void QgsTextFormatWidget::mPreviewTextEdit_textChanged(
const QString &text )
2249 lblFontPreview->setText( text );
2253void QgsTextFormatWidget::mPreviewTextBtn_clicked()
2255 mPreviewTextEdit->setText( u
"Lorem Ipsum"_s );
2259void QgsTextFormatWidget::mPreviewBackgroundBtn_colorChanged(
const QColor &color )
2264void QgsTextFormatWidget::mDirectSymbLeftToolBtn_clicked()
2266 bool gotChar =
false;
2268 const QChar initial = !mDirectSymbLeftLineEdit->text().isEmpty() ? mDirectSymbLeftLineEdit->text().at( 0 ) : QChar();
2269 const QChar dirSymb = mCharDlg->selectCharacter( &gotChar, mRefFont, mFontDB.styleString( mRefFont ), initial );
2274 if ( !dirSymb.isNull() )
2275 mDirectSymbLeftLineEdit->setText( QString( dirSymb ) );
2278void QgsTextFormatWidget::mDirectSymbRightToolBtn_clicked()
2280 bool gotChar =
false;
2281 const QChar initial = !mDirectSymbRightLineEdit->text().isEmpty() ? mDirectSymbRightLineEdit->text().at( 0 ) : QChar();
2282 const QChar dirSymb = mCharDlg->selectCharacter( &gotChar, mRefFont, mFontDB.styleString( mRefFont ), initial );
2287 if ( !dirSymb.isNull() )
2288 mDirectSymbRightLineEdit->setText( QString( dirSymb ) );
2291void QgsTextFormatWidget::chkLineOrientationDependent_toggled(
bool active )
2295 chkLineAbove->setText( tr(
"Left of line" ) );
2296 chkLineBelow->setText( tr(
"Right of line" ) );
2300 chkLineAbove->setText( tr(
"Above line" ) );
2301 chkLineBelow->setText( tr(
"Below line" ) );
2306void QgsTextFormatWidget::mToolButtonConfigureSubstitutes_clicked()
2311 QgsSubstitutionListWidget *widget =
new QgsSubstitutionListWidget( panel );
2319 QgsSubstitutionListDialog dlg(
this );
2321 if ( dlg.exec() == QDialog::Accepted )
2328void QgsTextFormatWidget::configureTabStops()
2333 QgsTabPositionWidget *widget =
new QgsTabPositionWidget( panel );
2336 widget->
setUnit( mTabDistanceUnitWidget->unit() );
2346 QgsTabPositionDialog dlg(
this );
2348 dlg.setUnit( mTabDistanceUnitWidget->unit() );
2349 if ( dlg.exec() == QDialog::Accepted )
2358void QgsTextFormatWidget::showBackgroundRadius(
bool show )
2360 mShapeRadiusLabel->setVisible( show );
2361 mShapeRadiusXDbSpnBx->setVisible( show );
2363 mShapeRadiusYDbSpnBx->setVisible( show );
2365 mShapeRadiusUnitWidget->setVisible( show );
2367 mShapeRadiusDDBtn->setVisible( show );
2368 mShapeRadiusUnitsDDBtn->setVisible( show );
2373 if (
auto *lExpressionContext =
mContext.expressionContext() )
2374 return *lExpressionContext;
2379 expContext =
mMapCanvas->createExpressionContext();
2401 if ( mGeometryGeneratorGroupBox->isChecked() )
2415 : QDialog( parent, fl )
2417 setWindowTitle( tr(
"Text Settings" ) );
2420 mFormatWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
2422 QVBoxLayout *layout =
new QVBoxLayout(
this );
2423 layout->addWidget( mFormatWidget );
2425 mButtonBox =
new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help, Qt::Horizontal,
this );
2426 layout->addWidget( mButtonBox );
2428 setLayout( layout );
2431 connect( mButtonBox->button( QDialogButtonBox::Ok ), &QAbstractButton::clicked,
this, &QDialog::accept );
2432 connect( mButtonBox->button( QDialogButtonBox::Cancel ), &QAbstractButton::clicked,
this, &QDialog::reject );
2433 connect( mButtonBox->button( QDialogButtonBox::Help ), &QAbstractButton::clicked,
this, &QgsTextFormatDialog::showHelp );
2438 return mFormatWidget->format();
2441void QgsTextFormatDialog::showHelp()
2443 QgsHelp::openHelp( u
"style_library/label_settings.html#formatting-the-label-text"_s );
2448 mFormatWidget->setContext( context );
2459 mFormatWidget = qobject_cast<QgsTextFormatWidget *>(
widget() );
2461 if ( !mBlockSignals )
2468 return mFormatWidget->format();
2473 mBlockSignals =
true;
2474 mFormatWidget->setFormat(
format );
2475 mBlockSignals =
false;
2480 mFormatWidget->setContext( context );
2485 mFormatWidget->setDockMode(
dockMode );
CurvedLabelMode
Modes which determine how curved labels are generated and placed.
@ StretchCharacterSpacingToFitLine
Increases (or decreases) the character spacing used for each label in order to fit the entire text ov...
@ Default
Default curved placement, characters are placed in an optimal position along the line....
@ StretchWordSpacingToFitLine
Increases (or decreases) the word spacing used for each label in order to fit the entire text over th...
@ PlaceCharactersAtVertices
Each individual character from the label text is placed such that their left-baseline position is loc...
@ LabelLargestPartOnly
Place a label only on the largest part from the geometry.
@ SplitLabelTextLinesOverParts
Splits the label text over the parts of the geometry, such that each consecutive part is labeled with...
@ LabelEveryPartWithEntireLabel
Place the (same) entire label over every part from the geometry.
@ FromPoint
Offset distance applies from point geometry.
@ FromSymbolBounds
Offset distance applies from rendered symbol bounds.
@ PreferCloser
Prefer closer labels, falling back to alternate positions before larger distances.
@ PreferPositionOrdering
Prefer labels follow position ordering, falling back to more distance labels before alternate positio...
LabelPlacement
Placement modes which determine how label candidates are generated for a feature.
@ OverPoint
Arranges candidates over a point (or centroid of a polygon), or at a preset offset from the point....
@ Curved
Arranges candidates following the curvature of a line feature. Applies to line layers only.
@ AroundPoint
Arranges candidates in a circle around a point (or centroid of a polygon). Applies to point or polygo...
@ Line
Arranges candidates parallel to a generalised line representing the feature or parallel to a polygon'...
@ Free
Arranges candidates scattered throughout a polygon feature. Candidates are rotated to respect the pol...
@ OrderedPositionsAroundPoint
Candidates are placed in predefined positions around a point. Preference is given to positions with g...
@ Horizontal
Arranges horizontal candidates scattered throughout a polygon feature. Applies to polygon layers only...
@ PerimeterCurved
Arranges candidates following the curvature of a polygon's boundary. Applies to polygon layers only.
@ OutsidePolygons
Candidates are placed outside of polygon boundaries. Applies to polygon layers only.
Capitalization
String capitalization options.
@ AllSmallCaps
Force all characters to small caps.
@ MixedCase
Mixed case, ie no change.
@ AllLowercase
Convert all characters to lowercase.
@ TitleCase
Simple title case conversion - does not fully grammatically parse the text and uses simple rules only...
@ SmallCaps
Mixed case small caps.
@ ForceFirstLetterToCapital
Convert just the first letter of each word to uppercase, leave the rest untouched.
@ AllUppercase
Convert all characters to uppercase.
TextOrientation
Text orientations.
@ Vertical
Vertically oriented text.
@ RotationBased
Horizontally or vertically oriented text based on rotation (only available for map labeling).
@ Horizontal
Horizontally oriented text.
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
@ Percentage
Percentage of another measurement (e.g., canvas size, feature size).
@ Millimeters
Millimeters.
@ Points
Points (e.g., for font sizes).
@ MetersInMapUnits
Meters value as Map units.
LabelOverlapHandling
Label overlap handling.
@ AllowOverlapAtNoCost
Labels may freely overlap other labels, at no cost.
@ AllowOverlapIfRequired
Avoids overlapping labels when possible, but permit overlaps if labels for features cannot otherwise ...
@ PreventOverlap
Do not allow labels to overlap other labels.
@ FlipUpsideDownLabels
Upside-down labels (90 <= angle < 270) are shown upright.
@ AlwaysAllowUpsideDown
Show upside down for all labels, including dynamic ones.
@ AllowUpsideDownWhenRotationIsDefined
Show upside down when rotation is layer- or data-defined.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static QgsSvgCache * svgCache()
Returns the application's SVG cache, used for caching SVG images and handling parameter replacement w...
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.
void collapsedStateChanged(bool collapsed)
Signal emitted when groupbox collapsed/expanded state is changed, and when first shown.
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
static QgsExpressionContextScope * atlasScope(const QgsLayoutAtlas *atlas)
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS 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.
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.
QgsFillSymbol * clone() const override
Returns a deep copy of this symbol.
static QFont createFont(const QString &family, int pointSize=-1, int weight=-1, bool italic=false)
Creates a font with the specified family.
static bool fontFamilyMatchOnSystem(const QString &family, QString *chosen=nullptr, bool *match=nullptr)
Check whether font family is on system.
static bool updateFontViaStyle(QFont &f, const QString &fontstyle, bool fallback=false)
Updates font with named style and retain all font properties.
static void setFontFamily(QFont &font, const QString &family)
Sets the family for a font object.
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
static QIcon iconForWkbType(Qgis::WkbType type)
Returns the icon for a vector layer whose geometry type is provided.
@ SymbolLeftRight
Place direction symbols on left/right of label.
@ SymbolAbove
Place direction symbols on above label.
@ SymbolBelow
Place direction symbols on below label.
static void warning(const QString &msg)
Goes to qWarning.
Map canvas is a class for displaying all GIS data types on a canvas.
Base class for all map layer types.
Contains configuration for rendering maps.
A marker symbol type, for rendering Point and MultiPoint geometries.
QgsMarkerSymbol * clone() const override
Returns a deep copy of this symbol.
static QgsPaintEffect * defaultStack()
Returns a new effect stack consisting of a sensible selection of default effects.
static bool isDefaultStack(QgsPaintEffect *effect)
Tests whether a paint effect matches the default effects stack.
Property
Data definable properties.
@ PositionX
X-coordinate data defined label position.
@ LinePlacementOptions
Line placement flags.
@ FontSizeUnit
Font size units.
@ WhitespaceCollisionHandling
Whitespace collision handling.
@ LabelRotation
Label rotation.
@ FontStyle
Font style name.
@ Italic
Use italic style.
@ ShapeOpacity
Shape opacity.
@ AllowDegradedPlacement
Allow degraded label placements.
@ MaskEnabled
Whether the mask is enabled.
@ PredefinedPositionOrder
@ OverlapHandling
Overlap handling technique.
@ PositionY
Y-coordinate data defined label position.
@ MaximumScale
Maximum map scale (ie most "zoomed in").
@ Vali
Vertical alignment for data defined label position (Bottom, Base, Half, Cap, Top).
@ MinimumScale
Minimum map scale (ie most "zoomed out").
@ FontStretchFactor
Font stretch factor, since QGIS 3.24.
@ PolygonLabelOutside
Whether labels outside a polygon feature are permitted, or should be forced.
@ BufferOpacity
Buffer opacity.
@ MaskJoinStyle
Mask join style.
@ Strikeout
Use strikeout.
@ LabelAllParts
Multipart geometry behavior.
@ LabelMarginDistance
Minimum distance from labels for this feature to other labels.
@ Underline
Use underline.
@ FontBlendMode
Text blend mode.
@ FontCase
Label text case.
@ Hali
Horizontal alignment for data defined label position (Left, Center, Right).
@ MaskOpacity
Mask opacity.
@ OverrunDistance
Distance which labels can extend past either end of linear features.
@ MaskBufferUnit
Mask buffer size unit.
@ FontOpacity
Text opacity.
@ FontWordSpacing
Word spacing.
@ CalloutDraw
Show callout.
@ CurvedLabelMode
Mode which determine how curved labels are generated and placed.
@ MaskBufferSize
Mask buffer size.
@ FontLetterSpacing
Letter spacing.
@ TabStopDistance
Tab stop distance, since QGIS 3.38.
@ ShadowOpacity
Shadow opacity.
@ RemoveDuplicateLabels
Whether this feature can cause removal of duplicate labels.
@ PositionPoint
Point-coordinate data defined label position.
@ MaximumDistance
Maximum distance of label from feature.
const QgsTextFormat & format() const
Returns the label text formatting settings, e.g., font settings, buffer settings, etc.
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the labeling property definitions.
QgsStyle * styleAtPath(const QString &path)
Returns a reference to the style database associated with the project with matching file path.
QVector< double > mapScales() const
Returns the list of custom project map scales.
static QgsProject * instance()
Returns the QgsProject singleton instance.
const QgsProjectStyleSettings * styleSettings() const
Returns the project's style settings, which contains settings and properties relating to how a QgsPro...
const QgsProjectViewSettings * viewSettings() const
Returns the project's view settings, which contains settings and properties relating to how a QgsProj...
A grouped map of multiple QgsProperty objects, each referenced by an integer key value.
QSet< int > propertyKeys() const final
Returns a list of property keys contained within the collection.
bool isActive(int key) const final
Returns true if the collection contains an active property with the specified key.
QgsProperty property(int key) const final
Returns a matching property from the collection, if one exists.
A store for object properties.
void setField(const QString &field)
Sets the field name the property references.
Stores settings for use within QGIS.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
bool contains(const QString &key, QgsSettings::Section section=QgsSettings::NoSection) const
Returns true if there exists a setting called key; returns false otherwise.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
A collection of string replacements (specified using QgsStringReplacement objects).
A dialog for setting properties of a newly saved style.
bool isFavorite() const
Returns true if the favorite is checked for the symbol.
QString name() const
Returns the entered name for the new symbol.
void setDefaultTags(const QString &tags)
Sets the default tags for the newly created item.
QString tags() const
Returns any tags entered for the new symbol (as a comma separated value list).
QgsStyle * destinationStyle()
Returns the destination style database.
A database of saved style entities, including symbols, color ramps, text formats and others.
QgsTextFormat textFormat(const QString &name) const
Returns the text format with the specified name.
QStringList textFormatNames() const
Returns a list of names of text formats in the style.
bool removeTextFormat(const QString &name)
Removes a text format from the style.
StyleEntity
Enum for Entities involved in a style.
@ LabelSettingsEntity
Label settings.
@ TextFormatEntity
Text formats.
@ SmartgroupEntity
Smart groups.
@ Symbol3DEntity
3D symbol entity
@ ColorrampEntity
Color ramps.
@ LegendPatchShapeEntity
Legend patch shape.
static QgsStyle * defaultStyle(bool initialize=true)
Returns the default application-wide style.
QStringList labelSettingsNames() const
Returns a list of names of label settings in the style.
static QgsTextFormat defaultTextFormatForProject(QgsProject *project, QgsStyle::TextFormatContext context=QgsStyle::TextFormatContext::Labeling)
Returns the default text format to use for new text based objects for the specified project,...
bool addTextFormat(const QString &name, const QgsTextFormat &format, bool update=false)
Adds a text format with the specified name to the style.
QgsPalLayerSettings labelSettings(const QString &name) const
Returns the label settings with the specified name.
bool saveTextFormat(const QString &name, const QgsTextFormat &format, bool favorite, const QStringList &tags)
Adds a text format to the database.
void containsParams(const QString &path, bool &hasFillParam, QColor &defaultFillColor, bool &hasStrokeParam, QColor &defaultStrokeColor, bool &hasStrokeWidthParam, double &defaultStrokeWidth, bool blocking=false) const
Tests if an SVG file contains parameters for fill, stroke color, stroke width.
A dialog for selection of an SVG file.
static QString svgSymbolNameToPath(const QString &name, const QgsPathResolver &pathResolver)
Determines an SVG symbol's path from its name.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
static QgsSymbol * defaultSymbol(Qgis::GeometryType geomType)
Returns a new default symbol for the specified geometry type.
Container for settings relating to a text background object.
QgsMapUnitScale strokeWidthMapUnitScale() const
Returns the map unit scale object for the shape stroke width.
void setRadiiUnit(Qgis::RenderUnit units)
Sets the units used for the shape's radii.
void setFillSymbol(QgsFillSymbol *symbol)
Sets the current fill symbol for the background shape.
RotationType rotationType() const
Returns the method used for rotating the background shape.
QString svgFile() const
Returns the absolute path to the background SVG file, if set.
QSizeF size() const
Returns the size of the background shape.
QSizeF radii() const
Returns the radii used for rounding the corners of shapes.
QgsMapUnitScale radiiMapUnitScale() const
Returns the map unit scale object for the shape radii.
void setOpacity(double opacity)
Sets the background shape's opacity.
void setStrokeColor(const QColor &color)
Sets the color used for outlining the background shape.
Qgis::RenderUnit radiiUnit() const
Returns the units used for the shape's radii.
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shape size.
QPainter::CompositionMode blendMode() const
Returns the blending mode used for drawing the background shape.
SizeType
Methods for determining the background shape size.
bool enabled() const
Returns whether the background is enabled.
double opacity() const
Returns the background shape's opacity.
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shape stroke width.
double rotation() const
Returns the rotation for the background shape, in degrees clockwise.
QColor fillColor() const
Returns the color used for filing the background shape.
void setMarkerSymbol(QgsMarkerSymbol *symbol)
Sets the current marker symbol for the background shape.
void setRadii(QSizeF radii)
Sets the radii used for rounding the corners of shapes.
SizeType sizeType() const
Returns the method used to determine the size of the background shape (e.g., fixed size or buffer aro...
Qgis::RenderUnit strokeWidthUnit() const
Returns the units used for the shape's stroke width.
ShapeType type() const
Returns the type of background shape (e.g., square, ellipse, SVG).
double strokeWidth() const
Returns the width of the shape's stroke (stroke).
void setSizeType(SizeType type)
Sets the method used to determine the size of the background shape (e.g., fixed size or buffer around...
ShapeType
Background shape types.
@ ShapeMarkerSymbol
Marker symbol.
@ ShapeSquare
Square - buffered sizes only.
@ ShapeRectangle
Rectangle.
void setFillColor(const QColor &color)
Sets the color used for filing the background shape.
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the background shape.
void setSizeUnit(Qgis::RenderUnit unit)
Sets the units used for the shape's size.
Qgis::RenderUnit offsetUnit() const
Returns the units used for the shape's offset.
QColor strokeColor() const
Returns the color used for outlining the background shape.
void setRotationType(RotationType type)
Sets the method used for rotating the background shape.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shape offset.
QgsFillSymbol * fillSymbol() const
Returns the fill symbol to be rendered in the background.
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the background shape.
QgsMapUnitScale sizeMapUnitScale() const
Returns the map unit scale object for the shape size.
void setType(ShapeType type)
Sets the type of background shape to draw (e.g., square, ellipse, SVG).
Qgis::RenderUnit sizeUnit() const
Returns the units used for the shape's size.
RotationType
Methods for determining the rotation of the background shape.
@ RotationSync
Shape rotation is synced with text rotation.
void setEnabled(bool enabled)
Sets whether the text background will be drawn.
QgsMarkerSymbol * markerSymbol() const
Returns the marker symbol to be rendered in the background.
void setRadiiMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shape radii.
void setRotation(double rotation)
Sets the rotation for the background shape, in degrees clockwise.
void setStrokeWidthUnit(Qgis::RenderUnit units)
Sets the units used for the shape's stroke width.
void setOffsetUnit(Qgis::RenderUnit units)
Sets the units used for the shape's offset.
void setOffset(QPointF offset)
Sets the offset used for drawing the background shape.
void setSize(QSizeF size)
Sets the size of the background shape.
const QgsPaintEffect * paintEffect() const
Returns the current paint effect for the background shape.
void setSvgFile(const QString &file)
Sets the path to the background SVG file.
QgsMapUnitScale offsetMapUnitScale() const
Returns the map unit scale object for the shape offset.
void setStrokeWidth(double width)
Sets the width of the shape's stroke (stroke).
QPointF offset() const
Returns the offset used for drawing the background shape.
Container for settings relating to a text buffer.
void setFillBufferInterior(bool fill)
Sets whether the interior of the buffer will be filled in.
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the buffer.
Qgis::RenderUnit sizeUnit() const
Returns the units for the buffer size.
Qt::PenJoinStyle joinStyle() const
Returns the buffer join style.
double size() const
Returns the size of the buffer.
void setColor(const QColor &color)
Sets the color for the buffer.
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the buffer size.
void setOpacity(double opacity)
Sets the buffer opacity.
QgsMapUnitScale sizeMapUnitScale() const
Returns the map unit scale object for the buffer size.
bool enabled() const
Returns whether the buffer is enabled.
double opacity() const
Returns the buffer opacity.
void setSizeUnit(Qgis::RenderUnit unit)
Sets the units used for the buffer size.
bool fillBufferInterior() const
Returns whether the interior of the buffer will be filled in.
void setEnabled(bool enabled)
Sets whether the text buffer will be drawn.
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the buffer.
const QgsPaintEffect * paintEffect() const
Returns the current paint effect for the buffer.
QColor color() const
Returns the color of the buffer.
QPainter::CompositionMode blendMode() const
Returns the blending mode used for drawing the buffer.
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style used for drawing the buffer.
void setSize(double size)
Sets the size of the buffer.
QgsTextFormat format() const
Returns the current formatting settings defined by the widget.
QDialogButtonBox * buttonBox() const
Returns a reference to the dialog's button box.
void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the widget is shown, e.g., the associated map canvas and expression context...
QgsTextFormatDialog(const QgsTextFormat &format, QgsMapCanvas *mapCanvas=nullptr, QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags, QgsMapLayer *layer=nullptr)
Constructor for QgsTextFormatDialog.
void setFormat(const QgsTextFormat &format)
Sets the format to show in the widget.
QgsTextFormatPanelWidget(const QgsTextFormat &format, QgsMapCanvas *mapCanvas=nullptr, QWidget *parent=nullptr, QgsMapLayer *layer=nullptr)
Constructor for QgsTextFormatPanelWidget.
void setDockMode(bool dockMode) override
Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs.
QgsTextFormat format() const
Returns the current formatting settings defined by the widget.
void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the widget is shown, e.g., the associated map canvas and expression context...
A widget for customizing text formatting settings.
void updatePlacementWidgets()
Updates label placement options to reflect current state of widget.
QListWidgetItem * mMaskItem
Mask widget item.
QButtonGroup * mUpsidedownBtnGrp
Upside down labels button group.
int mMinPixelLimit
Pixel size font limit.
QListWidgetItem * mBackgroundItem
Background widget item.
void setDockMode(bool enabled)
Sets whether the widget should be shown in a compact dock mode.
QgsMapCanvas * mMapCanvas
Associated map canvas.
void setPropertyOverrideButtonsVisible(bool visible)
Toggles whether data defined buttons should be shown in the widget.
QgsSymbolWidgetContext context() const
Returns the context in which the widget is shown, e.g., the associated map canvas and expression cont...
QgsTextFormatWidget(const QgsTextFormat &format=QgsTextFormat(), QgsMapCanvas *mapCanvas=nullptr, QWidget *parent=nullptr, QgsMapLayer *layer=nullptr)
Constructor for QgsTextFormatWidget.
QListWidgetItem * mFormattingItem
Formatting widget item.
~QgsTextFormatWidget() override
void deactivateField(QgsPalLayerSettings::Property key)
Deactivate a field from data defined properties and update the corresponding button.
void setFormat(const QgsTextFormat &format)
Sets the current formatting settings.
QListWidgetItem * mTextItem
Text widget item.
Qgis::GeometryType mGeomType
Geometry type for layer, if known.
QButtonGroup * mDirectSymbBtnGrp
Symbol direction button group.
void updateWidgetForFormat(const QgsTextFormat &format)
Updates the widget's state to reflect the settings in a QgsTextFormat.
QList< QgsSymbolLayerReference > mMaskedSymbolLayers
void widgetChanged()
Emitted when the text format defined by the widget changes.
void setPreviewBackground(const QColor &color)
Sets the background color for the text preview widget.
QButtonGroup * mQuadrantBtnGrp
Quadrant button group.
QListWidgetItem * mShadowItem
Shadow widget item.
QList< QgsTextFormat::Tab > mTabPositions
Tab positions.
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
QgsSymbolWidgetContext mContext
Context in which widget is shown.
QListWidgetItem * mBufferItem
Buffer widget item.
void updateLinePlacementOptions()
Updates line placement options to reflect current state of widget.
QListWidgetItem * mCalloutItem
Callout widget item.
void populateDataDefinedButtons()
Sets up connections required for data defined buttons, or updates the existing definition of these bu...
virtual void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the widget is shown, e.g., the associated map canvas and expression context...
QListWidgetItem * mRenderingItem
Rendering widget item.
void updatePreview()
Updates the text preview.
QListWidgetItem * mPlacementItem
Placement widget item.
void auxiliaryFieldCreated()
Emitted when an auxiliary field is created in the widget.
virtual void setFormatFromStyle(const QString &name, QgsStyle::StyleEntity type, const QString &stylePath)
Sets the current text settings from a style entry.
Qgis::GeometryType labelGeometryType() const
Returns the geometry type which will be used by the labeling engine when registering labels for the l...
QgsMapLayer * mLayer
Associated vector layer.
QgsStringReplacementCollection mSubstitutions
Text substitution list.
@ Text
Default mode, show text formatting settings only.
@ Labeling
Show labeling settings in addition to text formatting settings.
virtual void saveFormat()
Saves the current text settings to a style entry.
QgsPropertyCollection mDataDefinedProperties
Data defined properties as defined in the widget.
Container for all settings relating to text rendering.
Container for settings relating to a selective masking around a text.
void setEnabled(bool)
Returns whether the mask is enabled.
void setMaskedSymbolLayers(const QList< QgsSymbolLayerReference > &maskedLayers)
Sets the symbol layers that will be masked by this buffer.
Qgis::RenderUnit sizeUnit() const
Returns the units for the buffer size.
QList< QgsSymbolLayerReference > maskedSymbolLayers() const
Returns a list of references to symbol layers that are masked by this buffer.
void setSize(double size)
Sets the size of the buffer.
QgsMapUnitScale sizeMapUnitScale() const
Returns the map unit scale object for the buffer size.
double size() const
Returns the size of the buffer.
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the buffer size.
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the mask.
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style used for drawing the buffer.
double opacity() const
Returns the mask's opacity.
bool enabled() const
Returns whether the mask is enabled.
void setSizeUnit(Qgis::RenderUnit unit)
Sets the units used for the buffer size.
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the mask.
Qt::PenJoinStyle joinStyle() const
Returns the buffer join style.
void setOpacity(double opacity)
Sets the mask's opacity.
Container for settings relating to a text shadow.
int offsetAngle() const
Returns the angle for offsetting the position of the shadow from the text.
void setBlurRadiusMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shadow blur radius.
void setBlurRadiusUnit(Qgis::RenderUnit units)
Sets the units used for the shadow's blur radius.
bool enabled() const
Returns whether the shadow is enabled.
void setOffsetUnit(Qgis::RenderUnit units)
Sets the units used for the shadow's offset.
int scale() const
Returns the scaling used for the drop shadow (in percentage of original size).
Qgis::RenderUnit offsetUnit() const
Returns the units used for the shadow's offset.
void setShadowPlacement(QgsTextShadowSettings::ShadowPlacement placement)
Sets the placement for the drop shadow.
double opacity() const
Returns the shadow's opacity.
QgsMapUnitScale blurRadiusMapUnitScale() const
Returns the map unit scale object for the shadow blur radius.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shadow offset distance.
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the drop shadow.
void setColor(const QColor &color)
Sets the color for the drop shadow.
QColor color() const
Returns the color of the drop shadow.
void setOffsetGlobal(bool global)
Sets whether the global shadow offset should be used.
ShadowPlacement
Placement positions for text shadow.
@ ShadowBuffer
Draw shadow under buffer.
@ ShadowShape
Draw shadow under background shape.
@ ShadowLowest
Draw shadow below all text components.
@ ShadowText
Draw shadow under text.
void setScale(int scale)
Sets the scaling used for the drop shadow (in percentage of original size).
void setBlurAlphaOnly(bool alphaOnly)
Sets whether only the alpha channel for the shadow should be blurred.
QgsTextShadowSettings::ShadowPlacement shadowPlacement() const
Returns the placement for the drop shadow.
Qgis::RenderUnit blurRadiusUnit() const
Returns the units used for the shadow's blur radius.
double offsetDistance() const
Returns the distance for offsetting the position of the shadow from the text.
QPainter::CompositionMode blendMode() const
Returns the blending mode used for drawing the drop shadow.
void setOffsetDistance(double distance)
Sets the distance for offsetting the position of the shadow from the text.
void setOpacity(double opacity)
Sets the shadow's opacity.
QgsMapUnitScale offsetMapUnitScale() const
Returns the map unit scale object for the shadow offset distance.
bool blurAlphaOnly() const
Returns whether only the alpha channel for the shadow will be blurred.
bool offsetGlobal() const
Returns true if the global shadow offset will be used.
void setOffsetAngle(int angle)
Sets the angle for offsetting the position of the shadow from the text.
double blurRadius() const
Returns the blur radius for the shadow.
void setBlurRadius(double blurRadius)
Sets the blur radius for the shadow.
void setEnabled(bool enabled)
Sets whether the text shadow will be drawn.
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.
Q_INVOKABLE Qgis::GeometryType geometryType() const
Returns point, line or polygon.
QSize iconSize(bool dockableToolbar)
Returns the user-preferred size of a window's toolbar icons.
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly,...
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.