39 #include <QButtonGroup> 40 #include <QMessageBox> 44 , mMapCanvas( mapCanvas )
48 setWidgetMode(
Text );
62 setWidgetMode( mode );
65 void QgsTextFormatWidget::initWidget()
68 connect( mShapeSVGPathLineEdit, &QLineEdit::textChanged,
this, &QgsTextFormatWidget::mShapeSVGPathLineEdit_textChanged );
69 connect( mFontSizeSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsTextFormatWidget::mFontSizeSpinBox_valueChanged );
70 connect( mFontCapitalsComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsTextFormatWidget::mFontCapitalsComboBox_currentIndexChanged );
71 connect( mFontFamilyCmbBx, &QFontComboBox::currentFontChanged,
this, &QgsTextFormatWidget::mFontFamilyCmbBx_currentFontChanged );
72 connect( mFontStyleComboBox, &QComboBox::currentTextChanged,
this, &QgsTextFormatWidget::mFontStyleComboBox_currentIndexChanged );
73 connect( mFontUnderlineBtn, &QToolButton::toggled,
this, &QgsTextFormatWidget::mFontUnderlineBtn_toggled );
74 connect( mFontStrikethroughBtn, &QToolButton::toggled,
this, &QgsTextFormatWidget::mFontStrikethroughBtn_toggled );
75 connect( mFontWordSpacingSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsTextFormatWidget::mFontWordSpacingSpinBox_valueChanged );
76 connect( mFontLetterSpacingSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsTextFormatWidget::mFontLetterSpacingSpinBox_valueChanged );
78 connect( mFontMinPixelSpinBox, static_cast <
void ( QSpinBox::* )(
int ) > ( &QSpinBox::valueChanged ),
this, &QgsTextFormatWidget::mFontMinPixelSpinBox_valueChanged );
79 connect( mFontMaxPixelSpinBox, static_cast <
void ( QSpinBox::* )(
int ) > ( &QSpinBox::valueChanged ),
this, &QgsTextFormatWidget::mFontMaxPixelSpinBox_valueChanged );
83 connect( mShapeTypeCmbBx,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsTextFormatWidget::mShapeTypeCmbBx_currentIndexChanged );
84 connect( mShapeRotationCmbBx,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsTextFormatWidget::mShapeRotationCmbBx_currentIndexChanged );
85 connect( mShapeSVGParamsBtn, &QPushButton::clicked,
this, &QgsTextFormatWidget::mShapeSVGParamsBtn_clicked );
86 connect( mShapeSVGSelectorBtn, &QPushButton::clicked,
this, &QgsTextFormatWidget::mShapeSVGSelectorBtn_clicked );
87 connect( mPreviewTextEdit, &QLineEdit::textChanged,
this, &QgsTextFormatWidget::mPreviewTextEdit_textChanged );
88 connect( mPreviewTextBtn, &QToolButton::clicked,
this, &QgsTextFormatWidget::mPreviewTextBtn_clicked );
90 connect( mDirectSymbLeftToolBtn, &QToolButton::clicked,
this, &QgsTextFormatWidget::mDirectSymbLeftToolBtn_clicked );
91 connect( mDirectSymbRightToolBtn, &QToolButton::clicked,
this, &QgsTextFormatWidget::mDirectSymbRightToolBtn_clicked );
92 connect( mChkNoObstacle, &QCheckBox::toggled,
this, &QgsTextFormatWidget::mChkNoObstacle_toggled );
93 connect( chkLineOrientationDependent, &QCheckBox::toggled,
this, &QgsTextFormatWidget::chkLineOrientationDependent_toggled );
94 connect( mToolButtonConfigureSubstitutes, &QToolButton::clicked,
this, &QgsTextFormatWidget::mToolButtonConfigureSubstitutes_clicked );
95 connect( mKerningCheckBox, &QCheckBox::toggled,
this, &QgsTextFormatWidget::kerningToggled );
98 mOptionsTab->setIconSize( QSize( iconSize, iconSize ) );
102 mPointOffsetAboveLeft->setIconSize( QSize( iconSize32, iconSize18 ) );
103 mPointOffsetAbove->setIconSize( QSize( iconSize32, iconSize18 ) );
104 mPointOffsetAboveRight->setIconSize( QSize( iconSize32, iconSize18 ) );
105 mPointOffsetLeft->setIconSize( QSize( iconSize32, iconSize18 ) );
106 mPointOffsetOver ->setIconSize( QSize( iconSize32, iconSize18 ) );
107 mPointOffsetRight->setIconSize( QSize( iconSize32, iconSize18 ) );
108 mPointOffsetBelowLeft->setIconSize( QSize( iconSize32, iconSize18 ) );
109 mPointOffsetBelow->setIconSize( QSize( iconSize32, iconSize18 ) );
110 mPointOffsetBelowRight->setIconSize( QSize( iconSize32, iconSize18 ) );
111 mLabelMinScale->setPixmap(
QgsApplication::getThemeIcon( QStringLiteral(
"/mActionZoomOut.svg" ) ).pixmap( QSize( iconSize24, iconSize24 ) ) );
112 mLabelMaxScale->setPixmap(
QgsApplication::getThemeIcon( QStringLiteral(
"/mActionZoomIn.svg" ) ).pixmap( QSize( iconSize24, iconSize24 ) ) );
115 mFontUnderlineBtn->setMinimumSize( buttonSize, buttonSize );
116 mFontUnderlineBtn->setMaximumSize( buttonSize, buttonSize );
117 mFontStrikethroughBtn->setMinimumSize( buttonSize, buttonSize );
118 mFontStrikethroughBtn->setMaximumSize( buttonSize, buttonSize );
119 mFontBoldBtn->setMinimumSize( buttonSize, buttonSize );
120 mFontBoldBtn->setMaximumSize( buttonSize, buttonSize );
121 mFontItalicBtn->setMinimumSize( buttonSize, buttonSize );
122 mFontItalicBtn->setMaximumSize( buttonSize, buttonSize );
124 mPreviewScaleComboBox->setMapCanvas(
mMapCanvas );
125 mPreviewScaleComboBox->setShowCurrentScaleButton(
true );
128 const auto unitWidgets = findChildren<QgsUnitSelectionWidget *>();
129 for ( QgsUnitSelectionWidget *unitWidget : unitWidgets )
158 mFontLineHeightSpinBox->setClearValue( 1.0 );
159 mShapeRotationDblSpnBx->setClearValue( 0.0 );
160 mShapeOffsetXSpnBx->setClearValue( 0.0 );
161 mShapeOffsetYSpnBx->setClearValue( 0.0 );
162 mPointOffsetXSpinBox->setClearValue( 0.0 );
163 mPointOffsetYSpinBox->setClearValue( 0.0 );
164 mPointAngleSpinBox->setClearValue( 0.0 );
165 mFontLetterSpacingSpinBox->setClearValue( 0.0 );
166 mFontWordSpacingSpinBox->setClearValue( 0.0 );
167 mZIndexSpinBox->setClearValue( 0.0 );
168 mLineDistanceSpnBx->setClearValue( 0.0 );
183 updateAvailableShadowPositions();
186 mBackgroundSymbolButton->setDialogTitle( tr(
"Background Symbol" ) );
187 mBackgroundSymbolButton->registerExpressionContextGenerator(
this );
188 mBackgroundSymbolButton->setMapCanvas(
mMapCanvas );
192 mRefFont = lblFontPreview->font();
195 connect( mShadowOffsetAngleDial, &QAbstractSlider::valueChanged, mShadowOffsetAngleSpnBx, &QSpinBox::setValue );
196 connect( mShadowOffsetAngleSpnBx, static_cast <
void ( QSpinBox::* )(
int ) > ( &QSpinBox::valueChanged ), mShadowOffsetAngleDial, &QAbstractSlider::setValue );
197 connect( mLimitLabelChkBox, &QAbstractButton::toggled, mLimitLabelSpinBox, &QWidget::setEnabled );
198 connect( mCheckBoxSubstituteText, &QAbstractButton::toggled, mToolButtonConfigureSubstitutes, &QWidget::setEnabled );
208 populateFontCapitalsComboBox();
211 mPreviewBackgroundBtn->setColorDialogTitle( tr(
"Select Fill Color" ) );
212 mPreviewBackgroundBtn->setContext( QStringLiteral(
"labeling" ) );
213 mPreviewBackgroundBtn->setColor( QColor( 255, 255, 255 ) );
214 btnTextColor->setColorDialogTitle( tr(
"Select Text Color" ) );
215 btnTextColor->setContext( QStringLiteral(
"labeling" ) );
216 btnTextColor->setDefaultColor( Qt::black );
217 btnBufferColor->setColorDialogTitle( tr(
"Select Buffer Color" ) );
218 btnBufferColor->setContext( QStringLiteral(
"labeling" ) );
219 btnBufferColor->setDefaultColor( Qt::white );
220 mShapeStrokeColorBtn->setColorDialogTitle( tr(
"Select Stroke Color" ) );
221 mShapeStrokeColorBtn->setContext( QStringLiteral(
"labeling" ) );
222 mShapeFillColorBtn->setColorDialogTitle( tr(
"Select Fill Color" ) );
223 mShapeFillColorBtn->setContext( QStringLiteral(
"labeling" ) );
224 mShadowColorBtn->setColorDialogTitle( tr(
"Select Shadow Color" ) );
225 mShadowColorBtn->setContext( QStringLiteral(
"labeling" ) );
226 mShadowColorBtn->setDefaultColor( Qt::black );
228 mFontColorDDBtn->registerLinkedWidget( btnTextColor );
229 mBufferColorDDBtn->registerLinkedWidget( btnBufferColor );
230 mShapeStrokeColorDDBtn->registerLinkedWidget( mShapeStrokeColorBtn );
231 mShapeFillColorDDBtn->registerLinkedWidget( mShapeFillColorBtn );
232 mShadowColorDDBtn->registerLinkedWidget( mShadowColorBtn );
296 const auto groupBoxes = findChildren<QgsCollapsibleGroupBox *>();
299 grpbox->setSettingGroup( QStringLiteral(
"mAdvLabelingDlg" ) );
305 mLabelingOptionsListWidget->setAttribute( Qt::WA_MacShowFocusRect,
false );
310 QSizePolicy policy( mLabelingOptionsListFrame->sizePolicy() );
311 policy.setHorizontalStretch( 0 );
312 mLabelingOptionsListFrame->setSizePolicy( policy );
313 if ( !settings.
contains( QStringLiteral(
"/Windows/Labeling/OptionsSplitState" ) ) )
316 QList<int> splitsizes;
318 mLabelingOptionsSplitter->setSizes( splitsizes );
322 connect( mLabelStackedWidget, &QStackedWidget::currentChanged,
this, &QgsTextFormatWidget::optionsStackedWidget_CurrentChanged );
325 mFontPreviewSplitter->restoreState( settings.
value( QStringLiteral(
"Windows/Labeling/FontPreviewSplitState" ) ).toByteArray() );
326 mLabelingOptionsSplitter->restoreState( settings.
value( QStringLiteral(
"Windows/Labeling/OptionsSplitState" ) ).toByteArray() );
328 mLabelingOptionsListWidget->setCurrentRow( settings.
value( QStringLiteral(
"Windows/Labeling/Tab" ), 0 ).toInt() );
332 mBufferEffectWidget->setPaintEffect( mBufferEffect.get() );
335 mBackgroundEffectWidget->setPaintEffect( mBackgroundEffect.get() );
339 QList<QWidget *> widgets;
340 widgets << btnBufferColor
342 << chkLabelPerFeaturePart
346 << chkLineOrientationDependent
348 << chkPreserveRotation
350 << comboBufferBlendMode
352 << mBufferJoinStyleComboBox
353 << mBufferTranspFillChbx
354 << mBufferOpacityWidget
355 << mCentroidInsideCheckBox
358 << mDirectSymbLeftLineEdit
359 << mDirectSymbRevChkBx
360 << mDirectSymbRightLineEdit
361 << mFitInsidePolygonCheckBox
362 << mFontCapitalsComboBox
363 << mFontLetterSpacingSpinBox
364 << mFontLimitPixelChkBox
365 << mFontLineHeightSpinBox
366 << mFontMaxPixelSpinBox
367 << mFontMinPixelSpinBox
368 << mFontMultiLineAlignComboBox
370 << mFontStyleComboBox
371 << mTextOrientationComboBox
372 << mTextOpacityWidget
373 << mFontWordSpacingSpinBox
375 << mFormatNumDecimalsSpnBx
376 << mFormatNumPlusSignChkBx
378 << mLimitLabelSpinBox
379 << mLineDistanceSpnBx
380 << mLineDistanceUnitWidget
381 << mMaxCharAngleInDSpinBox
382 << mMaxCharAngleOutDSpinBox
384 << mObstacleFactorSlider
385 << mObstacleTypeComboBox
386 << mOffsetTypeComboBox
387 << mPalShowAllLabelsForLayerChkBx
388 << mPointAngleSpinBox
389 << mPointOffsetUnitWidget
390 << mPointOffsetXSpinBox
391 << mPointOffsetYSpinBox
392 << mPreviewBackgroundBtn
395 << mRepeatDistanceSpinBox
396 << mRepeatDistanceUnitWidget
397 << mOverrunDistanceSpinBox
398 << mOverrunDistanceUnitWidget
399 << mScaleBasedVisibilityChkBx
405 << mShadowOffsetAngleSpnBx
406 << mShadowOffsetGlobalChkBx
407 << mShadowOffsetSpnBx
408 << mShadowOffsetUnitWidget
409 << mShadowRadiusAlphaChkBx
410 << mShadowRadiusDblSpnBx
411 << mShadowRadiusUnitWidget
413 << mShadowOpacityWidget
416 << mShapeStrokeColorBtn
417 << mShapeStrokeWidthSpnBx
418 << mShapeStrokeWidthUnitWidget
420 << mShapeFillColorBtn
421 << mShapeOffsetXSpnBx
422 << mShapeOffsetYSpnBx
423 << mShapeOffsetUnitWidget
424 << mShapePenStyleCmbBx
425 << mShapeRadiusXDbSpnBx
426 << mShapeRadiusYDbSpnBx
427 << mShapeRotationCmbBx
428 << mShapeRotationDblSpnBx
429 << mShapeRadiusUnitWidget
430 << mShapeSVGPathLineEdit
432 << mShapeSizeUnitWidget
435 << mBackgroundOpacityWidget
440 << mAutoWrapLengthSpinBox
441 << mAutoWrapTypeComboBox
442 << mCentroidRadioVisible
443 << mCentroidRadioWhole
444 << mDirectSymbRadioBtnAbove
445 << mDirectSymbRadioBtnBelow
446 << mDirectSymbRadioBtnLR
447 << mUpsidedownRadioAll
448 << mUpsidedownRadioDefined
449 << mUpsidedownRadioOff
458 << radPolygonHorizontal
459 << radPolygonPerimeter
460 << radPolygonPerimeterCurved
461 << radPredefinedOrder
462 << mFieldExpressionWidget
463 << mCheckBoxSubstituteText
464 << mGeometryGeneratorGroupBox
465 << mGeometryGenerator
466 << mGeometryGeneratorType
467 << mBackgroundSymbolButton
468 << mCalloutsDrawCheckBox
469 << mCalloutStyleComboBox
476 connect( mBufferDrawChkBx, &QCheckBox::stateChanged, [ = ](
int )
478 updateBufferFrameStatus();
481 connect( mShapeDrawChkBx, &QCheckBox::stateChanged, [ = ](
int )
483 updateShapeFrameStatus();
486 mGeometryGeneratorType->addItem(
QgsApplication::getThemeIcon( QStringLiteral(
"/mIconPolygonLayer.svg" ) ), tr(
"Polygon / MultiPolygon" ), QgsWkbTypes::GeometryType::PolygonGeometry );
487 mGeometryGeneratorType->addItem(
QgsApplication::getThemeIcon( QStringLiteral(
"/mIconLineLayer.svg" ) ), tr(
"LineString / MultiLineString" ), QgsWkbTypes::GeometryType::LineGeometry );
488 mGeometryGeneratorType->addItem(
QgsApplication::getThemeIcon( QStringLiteral(
"/mIconPointLayer.svg" ) ), tr(
"Point / MultiPoint" ), QgsWkbTypes::GeometryType::PointGeometry );
491 whileBlocking( mOptionsTab )->setCurrentIndex( mLabelStackedWidget->currentIndex() );
511 toggleDDButtons(
true );
517 toggleDDButtons(
true );
518 delete mLabelingOptionsListWidget->takeItem( 7 );
519 delete mLabelingOptionsListWidget->takeItem( 6 );
520 delete mLabelingOptionsListWidget->takeItem( 5 );
521 mOptionsTab->removeTab( 7 );
522 mOptionsTab->removeTab( 6 );
523 mOptionsTab->removeTab( 5 );
525 frameLabelWith->hide();
526 mDirectSymbolsFrame->hide();
527 mFormatNumFrame->hide();
528 mFormatNumChkBx->hide();
529 mFormatNumDDBtn->hide();
530 mSubstitutionsFrame->hide();
536 void QgsTextFormatWidget::toggleDDButtons(
bool visible )
538 const auto buttons = findChildren< QgsPropertyOverrideButton * >();
541 button->setVisible( visible );
547 mOptionsTab->setVisible( enabled );
548 mOptionsTab->setTabToolTip( 0, tr(
"Text" ) );
549 mOptionsTab->setTabToolTip( 1, tr(
"Formatting" ) );
550 mOptionsTab->setTabToolTip( 2, tr(
"Buffer" ) );
551 mOptionsTab->setTabToolTip( 3, tr(
"Background" ) );
552 mOptionsTab->setTabToolTip( 4, tr(
"Shadow" ) );
553 mOptionsTab->setTabToolTip( 5, tr(
"Callouts" ) );
554 mOptionsTab->setTabToolTip( 6, tr(
"Placement" ) );
555 mOptionsTab->setTabToolTip( 7, tr(
"Rendering" ) );
557 mLabelingOptionsListFrame->setVisible( !enabled );
558 groupBox_mPreview->setVisible( !enabled );
562 void QgsTextFormatWidget::connectValueChanged(
const QList<QWidget *> &widgets,
const char *slot )
564 const auto constWidgets = widgets;
565 for ( QWidget *widget : constWidgets )
569 connect( w, SIGNAL( changed() ),
this, slot );
573 connect( w, SIGNAL( fieldChanged( QString ) ),
this, slot );
575 else if (
QgsOpacityWidget *w = qobject_cast< QgsOpacityWidget *>( widget ) )
577 connect( w, SIGNAL( opacityChanged(
double ) ),
this, slot );
579 else if (
QgsScaleWidget *w = qobject_cast< QgsScaleWidget *>( widget ) )
581 connect( w, SIGNAL( scaleChanged(
double ) ),
this, slot );
583 else if ( QgsUnitSelectionWidget *w = qobject_cast<QgsUnitSelectionWidget *>( widget ) )
585 connect( w, SIGNAL( changed() ),
this, slot );
587 else if ( QComboBox *w = qobject_cast<QComboBox *>( widget ) )
589 connect( w, SIGNAL( currentIndexChanged(
int ) ),
this, slot );
591 else if ( QSpinBox *w = qobject_cast<QSpinBox *>( widget ) )
593 connect( w, SIGNAL( valueChanged(
int ) ),
this, slot );
595 else if ( QDoubleSpinBox *w = qobject_cast<QDoubleSpinBox *>( widget ) )
597 connect( w, SIGNAL( valueChanged(
double ) ),
this, slot );
599 else if (
QgsColorButton *w = qobject_cast<QgsColorButton *>( widget ) )
601 connect( w, SIGNAL( colorChanged( QColor ) ),
this, slot );
603 else if ( QCheckBox *w = qobject_cast<QCheckBox *>( widget ) )
605 connect( w, SIGNAL( toggled(
bool ) ),
this, slot );
607 else if ( QRadioButton *w = qobject_cast<QRadioButton *>( widget ) )
609 connect( w, SIGNAL( toggled(
bool ) ),
this, slot );
611 else if ( QLineEdit *w = qobject_cast<QLineEdit *>( widget ) )
613 connect( w, SIGNAL( textEdited( QString ) ),
this, slot );
615 else if ( QSlider *w = qobject_cast<QSlider *>( widget ) )
617 connect( w, SIGNAL( valueChanged(
int ) ),
this, slot );
619 else if ( QGroupBox *w = qobject_cast<QGroupBox *>( widget ) )
621 connect( w, SIGNAL( toggled(
bool ) ),
this, slot );
625 connect( w, SIGNAL( textChanged() ),
this, slot );
629 QgsLogger::warning( QStringLiteral(
"Could not create connection for widget %1" ).arg( widget->objectName() ) );
660 mDirectSymbDDBtn->registerCheckedWidget( mDirectSymbChkBx );
668 mFormatNumDDBtn->registerCheckedWidget( mFormatNumChkBx );
674 mBufferDrawDDBtn->registerCheckedWidget( mBufferDrawChkBx );
684 mShapeDrawDDBtn->registerCheckedWidget( mShapeDrawChkBx );
707 mShadowDrawDDBtn->registerCheckedWidget( mShadowDrawChkBx );
739 QString ddPlaceInfo = tr(
"In edit mode, layer's relevant labeling map tool is:<br>" 740 " Defined attribute field -> <i>enabled</i><br>" 741 " Defined expression -> <i>disabled</i>" );
743 mCoordXDDBtn->setUsageInfo( ddPlaceInfo );
745 mCoordYDDBtn->setUsageInfo( ddPlaceInfo );
747 mCoordAlignmentHDDBtn->setUsageInfo( ddPlaceInfo );
749 mCoordAlignmentVDDBtn->setUsageInfo( ddPlaceInfo );
751 mCoordRotationDDBtn->setUsageInfo( ddPlaceInfo );
754 QString ddScaleVisInfo = tr(
"Value < 0 represents a scale closer than 1:1, e.g. -10 = 10:1<br>" 755 "Value of 0 disables the specific limit." );
757 mScaleBasedVisibilityDDBtn->registerCheckedWidget( mScaleBasedVisibilityChkBx );
759 mScaleBasedVisibilityMinDDBtn->setUsageInfo( ddScaleVisInfo );
761 mScaleBasedVisibilityMaxDDBtn->setUsageInfo( ddScaleVisInfo );
764 mFontLimitPixelDDBtn->registerCheckedWidget( mFontLimitPixelChkBox );
783 if ( !mButtons.contains( key ) )
788 mButtons[key] = button;
804 mBufferDrawChkBx->setChecked( buffer.
enabled() );
805 mBufferFrame->setEnabled( buffer.
enabled() );
806 spinBufferSize->setValue( buffer.
size() );
807 mBufferUnitWidget->setUnit( buffer.
sizeUnit() );
809 btnBufferColor->setColor( buffer.
color() );
810 mBufferOpacityWidget->setOpacity( buffer.
opacity() );
811 mBufferJoinStyleComboBox->setPenJoinStyle( buffer.
joinStyle() );
813 comboBufferBlendMode->setBlendMode( buffer.
blendMode() );
819 mBufferEffect->setEnabled(
false );
821 mBufferEffectWidget->setPaintEffect( mBufferEffect.get() );
823 mFontSizeUnitWidget->setUnit( format.
sizeUnit() );
825 mRefFont = format.
font();
826 mFontSizeSpinBox->setValue( format.
size() );
827 btnTextColor->setColor( format.
color() );
828 mTextOpacityWidget->setOpacity( format.
opacity() );
829 comboBlendMode->setBlendMode( format.
blendMode() );
830 mTextOrientationComboBox->setCurrentIndex( mTextOrientationComboBox->findData( format.
orientation() ) );
832 mFontWordSpacingSpinBox->setValue( format.
font().wordSpacing() );
833 mFontLetterSpacingSpinBox->setValue( format.
font().letterSpacing() );
837 updateFont( mRefFont );
840 mFontMissingLabel->setVisible( !format.
fontFound() );
843 QString missingTxt = tr(
"%1 not found. Default substituted." );
844 QString txtPrepend = tr(
"Chosen font" );
849 mFontMissingLabel->setText( missingTxt.arg( txtPrepend ) );
852 mLabelingOptionsListWidget->setCurrentRow( 0 );
854 mFontLineHeightSpinBox->setValue( format.
lineHeight() );
857 mShapeDrawChkBx->setChecked( background.
enabled() );
858 mShapeFrame->setEnabled( background.
enabled() || mBufferDrawDDBtn->isActive() );
859 mShapeTypeCmbBx->blockSignals(
true );
860 mShapeTypeCmbBx->setCurrentIndex( mShapeTypeCmbBx->findData( background.
type() ) );
861 mShapeTypeCmbBx->blockSignals(
false );
862 updateAvailableShadowPositions();
863 mShapeSVGPathLineEdit->setText( background.
svgFile() );
865 mShapeSizeCmbBx->setCurrentIndex( background.
sizeType() );
866 mShapeSizeXSpnBx->setValue( background.
size().width() );
867 mShapeSizeYSpnBx->setValue( background.
size().height() );
868 mShapeSizeUnitWidget->setUnit( background.
sizeUnit() );
870 mShapeRotationCmbBx->setCurrentIndex( background.
rotationType() );
873 mShapeRotationDblSpnBx->setValue( background.
rotation() );
874 mShapeOffsetXSpnBx->setValue( background.
offset().x() );
875 mShapeOffsetYSpnBx->setValue( background.
offset().y() );
876 mShapeOffsetUnitWidget->setUnit( background.
offsetUnit() );
878 mShapeRadiusXDbSpnBx->setValue( background.
radii().width() );
879 mShapeRadiusYDbSpnBx->setValue( background.
radii().height() );
880 mShapeRadiusUnitWidget->setUnit( background.
radiiUnit() );
883 mShapeFillColorBtn->setColor( background.
fillColor() );
884 mShapeStrokeColorBtn->setColor( background.
strokeColor() );
885 mShapeStrokeWidthSpnBx->setValue( background.
strokeWidth() );
888 mShapePenStyleCmbBx->setPenJoinStyle( background.
joinStyle() );
890 mBackgroundOpacityWidget->setOpacity( background.
opacity() );
891 mShapeBlendCmbBx->setBlendMode( background.
blendMode() );
893 mLoadSvgParams =
false;
894 mShapeTypeCmbBx_currentIndexChanged( background.
type() );
901 mBackgroundEffect->setEnabled(
false );
903 mBackgroundEffectWidget->setPaintEffect( mBackgroundEffect.get() );
908 mShadowDrawChkBx->setChecked( shadow.
enabled() );
909 mShadowUnderCmbBx->setCurrentIndex( mShadowUnderCmbBx->findData( shadow.
shadowPlacement() ) );
910 mShadowOffsetAngleSpnBx->setValue( shadow.
offsetAngle() );
912 mShadowOffsetUnitWidget->setUnit( shadow.
offsetUnit() );
914 mShadowOffsetGlobalChkBx->setChecked( shadow.
offsetGlobal() );
916 mShadowRadiusDblSpnBx->setValue( shadow.
blurRadius() );
919 mShadowRadiusAlphaChkBx->setChecked( shadow.
blurAlphaOnly() );
920 mShadowOpacityWidget->setOpacity( shadow.
opacity() );
921 mShadowScaleSpnBx->setValue( shadow.
scale() );
923 mShadowColorBtn->setColor( shadow.
color() );
924 mShadowBlendCmbBx->setBlendMode( shadow.
blendMode() );
936 settings.
setValue( QStringLiteral(
"Windows/Labeling/FontPreviewSplitState" ), mFontPreviewSplitter->saveState() );
937 settings.
setValue( QStringLiteral(
"Windows/Labeling/OptionsSplitState" ), mLabelingOptionsSplitter->saveState() );
938 settings.
setValue( QStringLiteral(
"Windows/Labeling/Tab" ), mLabelingOptionsListWidget->currentRow() );
944 format.
setColor( btnTextColor->color() );
946 format.
setSize( mFontSizeSpinBox->value() );
948 format.
setOpacity( mTextOpacityWidget->opacity() );
954 format.
setOrientation( static_cast< QgsTextFormat::TextOrientation >( mTextOrientationComboBox->currentData().toInt() ) );
958 buffer.
setEnabled( mBufferDrawChkBx->isChecked() );
959 buffer.
setSize( spinBufferSize->value() );
960 buffer.
setColor( btnBufferColor->color() );
961 buffer.
setOpacity( mBufferOpacityWidget->opacity() );
964 buffer.
setJoinStyle( mBufferJoinStyleComboBox->penJoinStyle() );
966 buffer.
setBlendMode( comboBufferBlendMode->blendMode() );
975 background.
setEnabled( mShapeDrawChkBx->isChecked() );
976 background.
setType( static_cast< QgsTextBackgroundSettings::ShapeType >( mShapeTypeCmbBx->currentData().toInt() ) );
977 background.
setSvgFile( mShapeSVGPathLineEdit->text() );
978 background.
setSizeType( static_cast< QgsTextBackgroundSettings::SizeType >( mShapeSizeCmbBx->currentIndex() ) );
979 background.
setSize( QSizeF( mShapeSizeXSpnBx->value(), mShapeSizeYSpnBx->value() ) );
980 background.
setSizeUnit( mShapeSizeUnitWidget->unit() );
982 background.
setRotationType( static_cast< QgsTextBackgroundSettings::RotationType >( mShapeRotationCmbBx->currentIndex() ) );
983 background.
setRotation( mShapeRotationDblSpnBx->value() );
984 background.
setOffset( QPointF( mShapeOffsetXSpnBx->value(), mShapeOffsetYSpnBx->value() ) );
987 background.
setRadii( QSizeF( mShapeRadiusXDbSpnBx->value(), mShapeRadiusYDbSpnBx->value() ) );
988 background.
setRadiiUnit( mShapeRadiusUnitWidget->unit() );
996 background.
setJoinStyle( mShapePenStyleCmbBx->penJoinStyle() );
997 background.
setOpacity( mBackgroundOpacityWidget->opacity() );
998 background.
setBlendMode( mShapeBlendCmbBx->blendMode() );
1008 shadow.
setEnabled( mShadowDrawChkBx->isChecked() );
1009 shadow.
setShadowPlacement( static_cast< QgsTextShadowSettings::ShadowPlacement >( mShadowUnderCmbBx->currentData().toInt() ) );
1019 shadow.
setOpacity( mShadowOpacityWidget->opacity() );
1020 shadow.
setScale( mShadowScaleSpnBx->value() );
1021 shadow.
setColor( mShadowColorBtn->color() );
1025 if ( includeDataDefinedProperties )
1056 if ( mButtons.contains( key ) )
1068 void QgsTextFormatWidget::optionsStackedWidget_CurrentChanged(
int indx )
1070 mLabelingOptionsListWidget->blockSignals(
true );
1071 mLabelingOptionsListWidget->setCurrentRow( indx );
1072 mLabelingOptionsListWidget->blockSignals(
false );
1086 const auto symbolButtonWidgets = findChildren<QgsSymbolButton *>();
1094 void QgsTextFormatWidget::collapseSample(
bool collapse )
1098 QList<int> splitSizes = mFontPreviewSplitter->sizes();
1099 if ( splitSizes[0] > groupBox_mPreview->height() )
1101 int delta = splitSizes[0] - groupBox_mPreview->height();
1102 splitSizes[0] -= delta;
1103 splitSizes[1] += delta;
1104 mFontPreviewSplitter->setSizes( splitSizes );
1109 void QgsTextFormatWidget::changeTextColor(
const QColor &color )
1115 void QgsTextFormatWidget::updateFont(
const QFont &font )
1118 if ( font != mRefFont )
1127 mDirectSymbLeftLineEdit->setFont( mRefFont );
1128 mDirectSymbRightLineEdit->setFont( mRefFont );
1130 blockFontChangeSignals(
true );
1131 mFontFamilyCmbBx->setCurrentFont( mRefFont );
1132 populateFontStyleComboBox();
1133 int idx = mFontCapitalsComboBox->findData( QVariant( static_cast< unsigned int >( mRefFont.capitalization() ) ) );
1134 mFontCapitalsComboBox->setCurrentIndex( idx == -1 ? 0 : idx );
1135 mFontUnderlineBtn->setChecked( mRefFont.underline() );
1136 mFontStrikethroughBtn->setChecked( mRefFont.strikeOut() );
1137 mKerningCheckBox->setChecked( mRefFont.kerning() );
1138 blockFontChangeSignals(
false );
1146 void QgsTextFormatWidget::blockFontChangeSignals(
bool blk )
1148 mFontFamilyCmbBx->blockSignals( blk );
1149 mFontStyleComboBox->blockSignals( blk );
1150 mFontCapitalsComboBox->blockSignals( blk );
1151 mFontUnderlineBtn->blockSignals( blk );
1152 mFontStrikethroughBtn->blockSignals( blk );
1153 mFontWordSpacingSpinBox->blockSignals( blk );
1154 mFontLetterSpacingSpinBox->blockSignals( blk );
1155 mKerningCheckBox->blockSignals( blk );
1170 lblFontPreview->setFormat(
format() );
1173 void QgsTextFormatWidget::scrollPreview()
1175 scrollArea_mPreview->ensureVisible( 0, 0, 0, 0 );
1180 mPreviewBackgroundColor = color;
1182 scrollArea_mPreview->widget()->setStyleSheet( QStringLiteral(
"background: rgb(%1, %2, %3);" ).arg( QString::number( color.red() ),
1183 QString::number( color.green() ),
1184 QString::number( color.blue() ) ) );
1187 void QgsTextFormatWidget::changeBufferColor(
const QColor &color )
1195 QWidget *curWdgt = stackedPlacement->currentWidget();
1197 bool showLineFrame =
false;
1198 bool showCentroidFrame =
false;
1199 bool showQuadrantFrame =
false;
1200 bool showFixedQuadrantFrame =
false;
1201 bool showPlacementPriorityFrame =
false;
1202 bool showOffsetTypeFrame =
false;
1203 bool showOffsetFrame =
false;
1204 bool showDistanceFrame =
false;
1205 bool showRotationFrame =
false;
1206 bool showMaxCharAngleFrame =
false;
1208 bool enableMultiLinesFrame =
true;
1210 if ( ( curWdgt == pagePoint && radAroundPoint->isChecked() )
1211 || ( curWdgt == pagePolygon && radAroundCentroid->isChecked() ) )
1213 showCentroidFrame = ( curWdgt == pagePolygon && radAroundCentroid->isChecked() );
1214 showDistanceFrame =
true;
1216 if ( curWdgt == pagePoint )
1218 showQuadrantFrame =
true;
1221 else if ( ( curWdgt == pagePoint && radOverPoint->isChecked() )
1222 || ( curWdgt == pagePolygon && radOverCentroid->isChecked() ) )
1224 showCentroidFrame = ( curWdgt == pagePolygon && radOverCentroid->isChecked() );
1225 showQuadrantFrame =
true;
1226 showFixedQuadrantFrame =
true;
1227 showOffsetFrame =
true;
1228 showRotationFrame =
true;
1230 else if ( curWdgt == pagePoint && radPredefinedOrder->isChecked() )
1232 showDistanceFrame =
true;
1233 showPlacementPriorityFrame =
true;
1234 showOffsetTypeFrame =
true;
1236 else if ( ( curWdgt == pageLine && radLineParallel->isChecked() )
1237 || ( curWdgt == pagePolygon && radPolygonPerimeter->isChecked() )
1238 || ( curWdgt == pageLine && radLineCurved->isChecked() )
1239 || ( curWdgt == pagePolygon && radPolygonPerimeterCurved->isChecked() ) )
1241 showLineFrame =
true;
1242 showDistanceFrame =
true;
1245 bool offline = chkLineAbove->isChecked() || chkLineBelow->isChecked();
1246 chkLineOrientationDependent->setEnabled( offline );
1247 mPlacementDistanceFrame->setEnabled( offline );
1249 bool isCurved = ( curWdgt == pageLine && radLineCurved->isChecked() )
1250 || ( curWdgt == pagePolygon && radPolygonPerimeterCurved->isChecked() );
1251 showMaxCharAngleFrame = isCurved;
1253 enableMultiLinesFrame = !isCurved;
1256 mPlacementLineFrame->setVisible( showLineFrame );
1257 mPlacementCentroidFrame->setVisible( showCentroidFrame );
1258 mPlacementQuadrantFrame->setVisible( showQuadrantFrame );
1259 mPlacementFixedQuadrantFrame->setVisible( showFixedQuadrantFrame );
1260 mPlacementCartographicFrame->setVisible( showPlacementPriorityFrame );
1261 mPlacementOffsetFrame->setVisible( showOffsetFrame );
1262 mPlacementDistanceFrame->setVisible( showDistanceFrame );
1263 mPlacementOffsetTypeFrame->setVisible( showOffsetTypeFrame );
1264 mPlacementRotationFrame->setVisible( showRotationFrame );
1265 mPlacementRepeatDistanceFrame->setVisible( curWdgt == pageLine || ( curWdgt == pagePolygon &&
1266 ( radPolygonPerimeter->isChecked() || radPolygonPerimeterCurved->isChecked() ) ) );
1267 mPlacementOverrunDistanceFrame->setVisible( curWdgt == pageLine );
1268 mPlacementMaxCharAngleFrame->setVisible( showMaxCharAngleFrame );
1270 mMultiLinesFrame->setEnabled( enableMultiLinesFrame );
1273 void QgsTextFormatWidget::populateFontCapitalsComboBox()
1275 mFontCapitalsComboBox->addItem( tr(
"No change" ), QVariant( 0 ) );
1276 mFontCapitalsComboBox->addItem( tr(
"All uppercase" ), QVariant( 1 ) );
1277 mFontCapitalsComboBox->addItem( tr(
"All lowercase" ), QVariant( 2 ) );
1281 mFontCapitalsComboBox->addItem( tr(
"Capitalize first letter" ), QVariant( 4 ) );
1284 void QgsTextFormatWidget::populateFontStyleComboBox()
1286 mFontStyleComboBox->clear();
1287 QStringList styles = mFontDB.styles( mRefFont.family() );
1288 const auto constStyles = styles;
1289 for (
const QString &style : constStyles )
1291 mFontStyleComboBox->addItem( style );
1294 QString targetStyle = mFontDB.styleString( mRefFont );
1295 if ( !styles.contains( targetStyle ) )
1297 QFont f = QFont( mRefFont.family() );
1298 targetStyle = QFontInfo( f ).styleName();
1299 mRefFont.setStyleName( targetStyle );
1302 int stylIndx = mFontStyleComboBox->findText( targetStyle );
1303 if ( stylIndx > -1 )
1308 mFontStyleComboBox->setCurrentIndex( curIndx );
1311 void QgsTextFormatWidget::mFontSizeSpinBox_valueChanged(
double d )
1313 mRefFont.setPointSizeF( d );
1314 updateFont( mRefFont );
1317 void QgsTextFormatWidget::mFontCapitalsComboBox_currentIndexChanged(
int index )
1319 int capitalsindex = mFontCapitalsComboBox->itemData( index ).toInt();
1320 mRefFont.setCapitalization( static_cast< QFont::Capitalization >( capitalsindex ) );
1321 updateFont( mRefFont );
1324 void QgsTextFormatWidget::mFontFamilyCmbBx_currentFontChanged(
const QFont &f )
1326 mRefFont.setFamily( f.family() );
1327 updateFont( mRefFont );
1330 void QgsTextFormatWidget::mFontStyleComboBox_currentIndexChanged(
const QString &text )
1333 updateFont( mRefFont );
1336 void QgsTextFormatWidget::mFontUnderlineBtn_toggled(
bool ckd )
1338 mRefFont.setUnderline( ckd );
1339 updateFont( mRefFont );
1342 void QgsTextFormatWidget::mFontStrikethroughBtn_toggled(
bool ckd )
1344 mRefFont.setStrikeOut( ckd );
1345 updateFont( mRefFont );
1348 void QgsTextFormatWidget::kerningToggled(
bool checked )
1350 mRefFont.setKerning( checked );
1351 updateFont( mRefFont );
1354 void QgsTextFormatWidget::mFontWordSpacingSpinBox_valueChanged(
double spacing )
1356 mRefFont.setWordSpacing( spacing );
1357 updateFont( mRefFont );
1360 void QgsTextFormatWidget::mFontLetterSpacingSpinBox_valueChanged(
double spacing )
1362 mRefFont.setLetterSpacing( QFont::AbsoluteSpacing, spacing );
1363 updateFont( mRefFont );
1366 void QgsTextFormatWidget::mFontSizeUnitWidget_changed()
1371 mFontLimitPixelChkBox->setChecked(
false );
1377 mFontLimitPixelChkBox->setChecked(
true );
1379 updateFont( mRefFont );
1382 void QgsTextFormatWidget::mFontMinPixelSpinBox_valueChanged(
int px )
1385 mFontMaxPixelSpinBox->setMinimum( px );
1386 mFontMaxPixelSpinBox->update();
1389 void QgsTextFormatWidget::mFontMaxPixelSpinBox_valueChanged(
int px )
1392 if ( px < mFontMinPixelSpinBox->value() )
1394 mFontMaxPixelSpinBox->blockSignals(
true );
1395 mFontMaxPixelSpinBox->setValue( mFontMinPixelSpinBox->value() );
1396 mFontMaxPixelSpinBox->blockSignals(
false );
1398 mFontMaxPixelSpinBox->setMinimum( mFontMinPixelSpinBox->value() );
1401 void QgsTextFormatWidget::mBufferUnitWidget_changed()
1403 updateFont( mRefFont );
1406 void QgsTextFormatWidget::mCoordXDDBtn_activated(
bool active )
1412 else if ( mCoordYDDBtn->isActive() )
1418 void QgsTextFormatWidget::mCoordYDDBtn_activated(
bool active )
1424 else if ( mCoordXDDBtn->isActive() )
1430 void QgsTextFormatWidget::mShapeTypeCmbBx_currentIndexChanged(
int )
1438 showBackgroundPenStyle( isRect );
1439 showBackgroundRadius( isRect );
1441 mShapeSVGPathFrame->setVisible( isSVG );
1442 mBackgroundSymbolButton->setVisible( isMarker );
1446 mShapeSizeYLabel->setVisible( !isSVG && !isMarker );
1447 mShapeSizeYSpnBx->setVisible( !isSVG && !isMarker );
1448 mShapeSizeYDDBtn->setVisible( !isSVG && !isMarker );
1449 mShapeSizeXLabel->setText( tr(
"Size%1" ).arg( !isSVG && !isMarker ? tr(
" X" ) : QString() ) );
1452 mShapeFillColorBtn->setAllowOpacity( !isSVG );
1453 mShapeFillColorBtn->setButtonBackground();
1454 mShapeStrokeColorBtn->setAllowOpacity( !isSVG );
1455 mShapeStrokeColorBtn->setButtonBackground();
1458 mShapeSVGParamsBtn->setVisible( isSVG );
1461 updateSvgWidgets( mShapeSVGPathLineEdit->text() );
1465 mShapeFillColorLabel->setEnabled( !isMarker );
1466 mShapeFillColorBtn->setEnabled( !isMarker );
1467 mShapeFillColorDDBtn->setEnabled( !isMarker );
1468 mShapeStrokeColorLabel->setEnabled( !isMarker );
1469 mShapeStrokeColorBtn->setEnabled( !isMarker );
1470 mShapeStrokeColorDDBtn->setEnabled( !isMarker );
1471 mShapeStrokeWidthLabel->setEnabled( !isMarker );
1472 mShapeStrokeWidthSpnBx->setEnabled( !isMarker );
1473 mShapeStrokeWidthDDBtn->setEnabled( !isMarker );
1477 mShapeStrokeWidthUnitWidget->setVisible( !isSVG && !isMarker );
1478 mShapeSVGUnitsLabel->setVisible( isSVG );
1479 mShapeStrokeUnitsDDBtn->setEnabled( !isSVG && !isMarker );
1481 updateAvailableShadowPositions();
1484 void QgsTextFormatWidget::mShapeSVGPathLineEdit_textChanged(
const QString &text )
1486 updateSvgWidgets( text );
1491 int numOptionsChecked = ( chkLineAbove->isChecked() ? 1 : 0 ) +
1492 ( chkLineBelow->isChecked() ? 1 : 0 ) +
1493 ( chkLineOn->isChecked() ? 1 : 0 );
1495 if ( numOptionsChecked == 1 )
1498 chkLineAbove->setEnabled( !chkLineAbove->isChecked() );
1499 chkLineBelow->setEnabled( !chkLineBelow->isChecked() );
1500 chkLineOn->setEnabled( !chkLineOn->isChecked() );
1504 chkLineAbove->setEnabled(
true );
1505 chkLineBelow->setEnabled(
true );
1506 chkLineOn->setEnabled(
true );
1516 void QgsTextFormatWidget::previewScaleChanged(
double scale )
1518 lblFontPreview->setScale( scale );
1521 void QgsTextFormatWidget::updateSvgWidgets(
const QString &svgPath )
1523 if ( mShapeSVGPathLineEdit->text() != svgPath )
1525 mShapeSVGPathLineEdit->setText( svgPath );
1528 QString resolvedPath;
1529 bool validSVG =
true;
1530 if ( ! svgPath.startsWith( QLatin1String(
"base64:" ), Qt::CaseInsensitive ) )
1533 validSVG = QFileInfo::exists( resolvedPath );
1537 resolvedPath = svgPath;
1542 mShapeSVGPathLineEdit->setStyleSheet( !validSVG ? QStringLiteral(
"QLineEdit{ color: rgb(225, 0, 0); }" ) : QString() );
1543 mShapeSVGPathLineEdit->setToolTip( !validSVG ? tr(
"File not found" ) : resolvedPath );
1545 QColor fill, stroke;
1546 double strokeWidth = 0.0;
1547 bool fillParam =
false, strokeParam =
false, strokeWidthParam =
false;
1553 mShapeSVGParamsBtn->setEnabled( validSVG && ( fillParam || strokeParam || strokeWidthParam ) );
1555 mShapeFillColorLabel->setEnabled( validSVG && fillParam );
1556 mShapeFillColorBtn->setEnabled( validSVG && fillParam );
1557 mShapeFillColorDDBtn->setEnabled( validSVG && fillParam );
1558 if ( mLoadSvgParams && validSVG && fillParam )
1559 mShapeFillColorBtn->setColor( fill );
1561 mShapeStrokeColorLabel->setEnabled( validSVG && strokeParam );
1562 mShapeStrokeColorBtn->setEnabled( validSVG && strokeParam );
1563 mShapeStrokeColorDDBtn->setEnabled( validSVG && strokeParam );
1564 if ( mLoadSvgParams && validSVG && strokeParam )
1565 mShapeStrokeColorBtn->setColor( stroke );
1567 mShapeStrokeWidthLabel->setEnabled( validSVG && strokeWidthParam );
1568 mShapeStrokeWidthSpnBx->setEnabled( validSVG && strokeWidthParam );
1569 mShapeStrokeWidthDDBtn->setEnabled( validSVG && strokeWidthParam );
1570 if ( mLoadSvgParams && validSVG && strokeWidthParam )
1571 mShapeStrokeWidthSpnBx->setValue( strokeWidth );
1577 mShapeSVGUnitsLabel->setEnabled( validSVG && strokeWidthParam );
1580 void QgsTextFormatWidget::updateAvailableShadowPositions()
1582 if ( mShadowUnderCmbBx->count() == 0
1588 mShadowUnderCmbBx->clear();
1596 mShadowUnderCmbBx->setCurrentIndex( mShadowUnderCmbBx->findData( currentPlacement ) );
1597 if ( mShadowUnderCmbBx->currentIndex() == -1 )
1598 mShadowUnderCmbBx->setCurrentIndex( 0 );
1602 void QgsTextFormatWidget::updateProperty()
1610 void QgsTextFormatWidget::createAuxiliaryField()
1637 property.setActive(
true );
1646 void QgsTextFormatWidget::updateShapeFrameStatus()
1648 mShapeFrame->setEnabled( mShapeDrawDDBtn->isActive() || mShapeDrawChkBx->isChecked() );
1651 void QgsTextFormatWidget::updateBufferFrameStatus()
1653 mBufferFrame->setEnabled( mBufferDrawDDBtn->isActive() || mBufferDrawChkBx->isChecked() );
1695 QgsStyleSaveDialog saveDlg(
this );
1696 saveDlg.setDefaultTags( mTextFormatsListWidget->currentTagFilter() );
1697 if ( !saveDlg.exec() )
1700 if ( saveDlg.name().isEmpty() )
1706 int res = QMessageBox::warning(
this, tr(
"Save Text Format" ),
1707 tr(
"Format with name '%1' already exists. Overwrite?" )
1708 .arg( saveDlg.name() ),
1709 QMessageBox::Yes | QMessageBox::No );
1710 if ( res != QMessageBox::Yes )
1717 QStringList symbolTags = saveDlg.tags().split(
',' );
1721 style->
saveTextFormat( saveDlg.name(), newFormat, saveDlg.isFavorite(), symbolTags );
1724 void QgsTextFormatWidget::mShapeSVGSelectorBtn_clicked()
1727 svgDlg.setWindowTitle( tr(
"Select SVG file" ) );
1730 if ( svgDlg.exec() == QDialog::Accepted )
1733 if ( !svgPath.isEmpty() )
1735 mShapeSVGPathLineEdit->setText( svgPath );
1741 void QgsTextFormatWidget::mShapeSVGParamsBtn_clicked()
1743 QString svgPath = mShapeSVGPathLineEdit->text();
1744 mLoadSvgParams =
true;
1745 updateSvgWidgets( svgPath );
1746 mLoadSvgParams =
false;
1749 void QgsTextFormatWidget::mShapeRotationCmbBx_currentIndexChanged(
int index )
1755 void QgsTextFormatWidget::mPreviewTextEdit_textChanged(
const QString &text )
1757 lblFontPreview->setText( text );
1761 void QgsTextFormatWidget::mPreviewTextBtn_clicked()
1763 mPreviewTextEdit->setText( QStringLiteral(
"Lorem Ipsum" ) );
1767 void QgsTextFormatWidget::mPreviewBackgroundBtn_colorChanged(
const QColor &color )
1772 void QgsTextFormatWidget::mDirectSymbLeftToolBtn_clicked()
1774 bool gotChar =
false;
1776 const QChar initial = !mDirectSymbLeftLineEdit->text().isEmpty() ? mDirectSymbLeftLineEdit->text().at( 0 ) : QChar();
1777 QChar dirSymb = mCharDlg->
selectCharacter( &gotChar, mRefFont, mFontDB.styleString( mRefFont ), initial );
1782 if ( !dirSymb.isNull() )
1783 mDirectSymbLeftLineEdit->setText( QString( dirSymb ) );
1786 void QgsTextFormatWidget::mDirectSymbRightToolBtn_clicked()
1788 bool gotChar =
false;
1789 const QChar initial = !mDirectSymbRightLineEdit->text().isEmpty() ? mDirectSymbRightLineEdit->text().at( 0 ) : QChar();
1790 QChar dirSymb = mCharDlg->
selectCharacter( &gotChar, mRefFont, mFontDB.styleString( mRefFont ), initial );
1795 if ( !dirSymb.isNull() )
1796 mDirectSymbRightLineEdit->setText( QString( dirSymb ) );
1799 void QgsTextFormatWidget::mChkNoObstacle_toggled(
bool active )
1801 mPolygonObstacleTypeFrame->setEnabled( active );
1802 mObstaclePriorityFrame->setEnabled( active );
1805 void QgsTextFormatWidget::chkLineOrientationDependent_toggled(
bool active )
1809 chkLineAbove->setText( tr(
"Left of line" ) );
1810 chkLineBelow->setText( tr(
"Right of line" ) );
1814 chkLineAbove->setText( tr(
"Above line" ) );
1815 chkLineBelow->setText( tr(
"Below line" ) );
1820 void QgsTextFormatWidget::mToolButtonConfigureSubstitutes_clicked()
1835 if ( dlg.exec() == QDialog::Accepted )
1842 void QgsTextFormatWidget::showBackgroundRadius(
bool show )
1844 mShapeRadiusLabel->setVisible( show );
1845 mShapeRadiusXDbSpnBx->setVisible( show );
1847 mShapeRadiusYDbSpnBx->setVisible( show );
1849 mShapeRadiusUnitWidget->setVisible( show );
1851 mShapeRadiusDDBtn->setVisible( show && mWidgetMode ==
Labeling );
1852 mShapeRadiusUnitsDDBtn->setVisible( show && mWidgetMode ==
Labeling );
1855 void QgsTextFormatWidget::showBackgroundPenStyle(
bool show )
1857 mShapePenStyleLabel->setVisible( show );
1858 mShapePenStyleCmbBx->setVisible( show );
1860 mShapePenStyleDDBtn->setVisible( show && mWidgetMode ==
Labeling );
1865 mCoordAlignmentFrame->setEnabled( enable );
1896 : QDialog( parent, fl )
1898 setWindowTitle( tr(
"Text Settings" ) );
1901 mFormatWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
1903 QVBoxLayout *layout =
new QVBoxLayout(
this );
1904 layout->addWidget( mFormatWidget );
1906 mButtonBox =
new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help, Qt::Horizontal,
this );
1907 layout->addWidget( mButtonBox );
1909 setLayout( layout );
1912 connect( mButtonBox->button( QDialogButtonBox::Ok ), &QAbstractButton::clicked,
this, &QDialog::accept );
1913 connect( mButtonBox->button( QDialogButtonBox::Cancel ), &QAbstractButton::clicked,
this, &QDialog::reject );
1914 connect( mButtonBox->button( QDialogButtonBox::Help ), &QAbstractButton::clicked,
this, &QgsTextFormatDialog::showHelp );
1919 return mFormatWidget->
format();
1922 void QgsTextFormatDialog::showHelp()
1924 QgsHelp::openHelp( QStringLiteral(
"style_library/label_settings.html#formatting-the-label-text" ) );
1946 return mFormatWidget->
format();
void setProperty(int key, const QgsProperty &property)
Adds a property to the collection and takes ownership of it.
static const QString EXPR_ORIGINAL_VALUE
Inbuilt variable name for value original value variable.
QPainter::CompositionMode blendMode() const
Returns the blending mode used for drawing the buffer.
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the labeling property definitions.
static QgsSvgCache * svgCache()
Returns the application's SVG cache, used for caching SVG images and handling parameter replacement w...
QColor strokeColor() const
Returns the color used for outlining the background shape.
void setScale(int scale)
Sets the scaling used for the drop shadow (in percentage of original size).
Meters value as Map units.
void setLineHeight(double height)
Sets the line height for text.
void setRadiiUnit(QgsUnitTypes::RenderUnit units)
Sets the units used for the shape's radii.
void setStrokeWidth(double width)
Sets the width of the shape's stroke (stroke).
bool addTextFormat(const QString &name, const QgsTextFormat &format, bool update=false)
Adds a text format with the specified name to the style.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shadow offset distance.
Horizontally or vertically oriented text based on rotation (only available for map labeling) ...
void setOpacity(double opacity)
Sets the text's opacity.
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shape stroke width.
void setOffsetUnit(QgsUnitTypes::RenderUnit units)
Sets the units used for the shadow's offset.
QgsTextShadowSettings::ShadowPlacement shadowPlacement() const
Returns the placement for the drop shadow.
QSizeF radii() const
Returns the radii used for rounding the corners of shapes.
QSizeF size() const
Returns the size of the background shape.
double opacity() const
Returns the text's opacity.
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units used for the shape's size.
void setOrientation(TextOrientation orientation)
Sets the orientation for the text.
bool fontFound() const
Returns true if the specified font was found on the system, or false if the font was not found and a ...
QPainter::CompositionMode blendMode() const
Returns the blending mode used for drawing the drop shadow.
QPointF offset() const
Returns the offset used for drawing the background shape.
QColor fillColor() const
Returns the color used for filing the background shape.
QgsMapUnitScale strokeWidthMapUnitScale() const
Returns the map unit scale object for the shape stroke width.
void setDockMode(bool enabled)
Sets whether the widget should be shown in a compact dock mode.
bool exists(const QgsPropertyDefinition &definition) const
Returns true if the property is stored in the layer already, false otherwise.
This class is a composition of two QSettings instances:
void populateDataDefinedButtons()
Sets up connections required for data defined buttons, or updates the existing definition of these bu...
A groupbox that collapses/expands when toggled and can save its collapsed and checked states...
void setPreviewBackgroundColor(const QColor &color)
Sets the background color that text will be rendered on for previews.
Draw shadow under buffer.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
ShadowPlacement
Placement positions for text shadow.
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly...
Place direction symbols on below label.
virtual void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the widget is shown, e.g., the associated map canvas and expression context...
Arranges candidates over a point (or centroid of a polygon), or at a preset offset from the point...
QgsTextShadowSettings & shadow()
Returns a reference to the text drop shadow settings.
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.
double blurRadius() const
Returns the blur radius for the shadow.
Arranges candidates following the curvature of a line feature. Applies to line layers only...
double opacity() const
Returns the background shape's opacity.
static void warning(const QString &msg)
Goes to qWarning.
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the size.
void setStrokeColor(const QColor &color)
Sets the color used for outlining the background shape.
void setSize(double size)
Sets the size of the buffer.
double strokeWidth() const
Returns the width of the shape's stroke (stroke).
A QGIS expression editor based on QScintilla2.
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units used for the buffer size.
double offsetDistance() const
Returns the distance for offsetting the position of the shadow from the text.
QButtonGroup * mUpsidedownBtnGrp
Upside down labels button group.
void setFont(const QFont &font)
Sets the font used for rendering text.
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style used for drawing the buffer.
static bool isDefaultStack(QgsPaintEffect *effect)
Tests whether a paint effect matches the default effects stack.
void collapsedStateChanged(bool collapsed)
Signal emitted when groupbox collapsed/expanded state is changed, and when first shown.
Candidates are placed in predefined positions around a point. Preference is given to positions with g...
void setOffsetUnit(QgsUnitTypes::RenderUnit units)
Sets the units used for the shape's offset.
QColor color() const
Returns the color that text will be rendered in.
QgsSymbolWidgetContext mContext
Context in which widget is shown.
void setFillBufferInterior(bool fill)
Sets whether the interior of the buffer will be filled in.
void setBlurRadius(double blurRadius)
Sets the blur radius for the shadow.
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the buffer.
void setOpacity(double opacity)
Sets the shadow's opacity.
X-coordinate data defined label position.
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shape size.
void setDockMode(bool dockMode) override
Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs...
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
void updateWidgetForFormat(const QgsTextFormat &format)
Updates the widget's state to reflect the settings in a QgsTextFormat.
QgsTextFormat format() const
Returns the current formatting settings defined by the widget.
A dialog for selecting a single character from a single font.
void setBackground(const QgsTextBackgroundSettings &backgroundSettings)
Sets the text's background settings.q.
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style used for drawing the background shape.
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
void setMarkerSymbol(QgsMarkerSymbol *symbol)
Sets the current marker symbol for the background shape.
Container for settings relating to a text background object.
A widget for customizing text formatting settings.
Percentage of another measurement (e.g., canvas size, feature size)
static QgsGui * instance()
Returns a pointer to the singleton instance.
QgsMapUnitScale offsetMapUnitScale() const
Returns the map unit scale object for the shape offset.
void setRadiiMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shape radii.
void setBlurRadiusUnit(QgsUnitTypes::RenderUnit units)
Sets the units used for the shadow's blur radius.
static QgsExpressionContextScope * atlasScope(const QgsLayoutAtlas *atlas)
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
void setBlurRadiusMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shadow blur radius.
QList< QgsUnitTypes::RenderUnit > RenderUnitList
List of render units.
Map canvas is a class for displaying all GIS data types on a canvas.
A marker symbol type, for rendering Point and MultiPoint geometries.
Show labeling settings in addition to text formatting settings.
static QgsStyle * defaultStyle()
Returns default application-wide style.
ShapeType type() const
Returns the type of background shape (e.g., square, ellipse, SVG).
void setOffset(QPointF offset)
Sets the offset used for drawing the background shape.
virtual QgsPaintEffect * clone() const =0
Duplicates an effect by creating a deep copy of the effect.
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
Qt::PenJoinStyle joinStyle() const
Returns the buffer join style.
Arranges horizontal candidates scattered throughout a polygon feature. Applies to polygon layers only...
QgsUnitTypes::DistanceUnit mapUnits() const
Gets units of map's geographical coordinates - used for scale calculation.
StyleEntity
Enum for Entities involved in a style.
QgsMapUnitScale sizeMapUnitScale() const
Returns the map unit scale object for the buffer size.
Place direction symbols on left/right of label.
QgsVectorLayer * mLayer
Associated vector layer.
A dialog to create a new auxiliary layer.
void setField(const QString &field)
Sets the field name the property references.
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the background shape.
Property
Data definable properties.
QgsMapUnitScale offsetMapUnitScale() const
Returns the map unit scale object for the shadow offset distance.
QStringList textFormatNames() const
Returns a list of names of text formats in the style.
QgsPalLayerSettings labelSettings(const QString &name) const
Returns the label settings with the specified name.
QPainter::CompositionMode blendMode() const
Returns the blending mode used for drawing the text.
static QgsSymbol * defaultSymbol(QgsWkbTypes::GeometryType geomType)
Returns a new default symbol for the specified geometry type.
QColor color() const
Returns the color of the drop shadow.
void setSize(double size)
Sets the size for rendered text.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context...
void setOffsetDistance(double distance)
Sets the distance for offsetting the position of the shadow from the text.
void widgetChanged()
Emitted when the text format defined by the widget changes.
static QgsPaintEffect * defaultStack()
Returns a new effect stack consisting of a sensible selection of default effects. ...
QColor previewBackgroundColor() const
Returns the background color for text previews.
QgsMapUnitScale blurRadiusMapUnitScale() const
Returns the map unit scale object for the shadow blur radius.
Offset distance applies from point geometry.
Default mode, show text formatting settings only.
QgsPropertyCollection mDataDefinedProperties
Data defined properties as defined in the widget.
bool fillBufferInterior() const
Returns whether the interior of the buffer will be filled in.
TextOrientation orientation() const
Returns the orientation of the text.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown...
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shape offset.
Maximum map scale (ie most "zoomed in")
void setBlurAlphaOnly(bool alphaOnly)
Sets whether only the alpha channel for the shadow should be blurred.
RotationType rotationType() const
Returns the method used for rotating the background shape.
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the buffer size.
double scale() const
Returns the calculated map scale.
Show upside down for all labels, including dynamic ones.
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the background shape.
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the drop shadow.
Vertically oriented text.
QChar selectCharacter(bool *gotChar, const QFont &font, const QString &style, QChar initialSelection=QChar())
Opens the dialog modally and returns when the user has selected a character.
void enableDataDefinedAlignment(bool enable)
Controls whether data defined alignment buttons are enabled.
void setActive(bool active)
Sets whether the property is currently active.
void setColor(const QColor &color)
Sets the color for the drop shadow.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void setEnabled(bool enabled)
Sets whether the text shadow will be drawn.
void setEnabled(bool enabled)
Sets whether the text buffer will be drawn.
void setFormat(const QgsTextFormat &format)
Sets the current formatting settings.
Horizontal alignment for data defined label position (Left, Center, Right)
Arranges candidates in a circle around a point (or centroid of a polygon). Applies to point or polygo...
void setColor(const QColor &color)
Sets the color that text will be rendered in.
QgsMapUnitScale radiiMapUnitScale() const
Returns the map unit scale object for the shape radii.
QString svgFile() const
Returns the absolute path to the background SVG file, if set.
Qt::PenJoinStyle joinStyle() const
Returns the join style used for drawing the background shape.
void setNamedStyle(const QString &style)
Sets the named style for the font used for rendering text.
QgsTextBackgroundSettings & background()
Returns a reference to the text background settings.
QgsTextBufferSettings & buffer()
Returns a reference to the text buffer settings.
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the size of rendered text.
Upside-down labels (90 <= angle < 270) are shown upright.
double opacity() const
Returns the buffer opacity.
void updateLinePlacementOptions()
Updates line placement options to reflect current state of widget.
void auxiliaryFieldCreated()
Emitted when an auxiliary field is creatd in the widget.
void setSize(QSizeF size)
Sets the size of the background shape.
QgsStringReplacementCollection mSubstitutions
Text substitution list.
A store for object properties.
void setRadii(QSizeF radii)
Sets the radii used for rounding the corners of shapes.
QSize iconSize(bool dockableToolbar)
Returns the user-preferred size of a window's toolbar icons.
QgsAuxiliaryLayer * auxiliaryLayer()
Returns the current auxiliary layer.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the format's property collection, used for data defined overrides.
void setPreviewBackground(const QColor &color)
Sets the background color for the text preview widget.
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the units used for the shape's stroke width.
Minimum map scale (ie most "zoomed out")
QgsTextFormat textFormat(const QString &name) const
Returns the text format with the specified name.
Offset distance applies from rendered symbol bounds.
void setSizeType(SizeType type)
Sets the method used to determine the size of the background shape (e.g., fixed size or buffer around...
const QgsTextFormat & format() const
Returns the label text formatting settings, e.g., font settings, buffer settings, etc...
Definition for a property.
void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the widget is shown, e.g., the associated map canvas and expression context...
void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the widget is shown, e.g., the associated map canvas and expression context...
void setType(ShapeType type)
Sets the type of background shape to draw (e.g., square, ellipse, SVG).
Place direction symbols on above label.
Draw shadow below all text components.
virtual void setFormatFromStyle(const QString &name, QgsStyle::StyleEntity type)
Sets the current text settings from a style entry.
QPainter::CompositionMode blendMode() const
Returns the blending mode used for drawing the background shape.
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units used for the shape's offset.
double rotation() const
Returns the rotation for the background shape, in degrees clockwise.
double lineHeight() const
Returns the line height for text.
QButtonGroup * mPlaceLineBtnGrp
Line placement button group.
void setEnabled(bool enabled)
Sets whether the text background will be drawn.
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
int offsetAngle() const
Returns the angle for offsetting the position of the shadow from the text.
ShapeType
Background shape types.
QgsSymbolWidgetContext context() const
Returns the context in which the widget is shown, e.g., the associated map canvas and expression cont...
bool saveTextFormat(const QString &name, const QgsTextFormat &format, bool favorite, const QStringList &tags)
Adds a text format to the database.
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
virtual void saveFormat()
Saves the current text settings to a style entry.
bool removeTextFormat(const QString &name)
Removes a text format from the style.
QgsSvgSelectorWidget * svgSelector()
Returns pointer to the embedded SVG selector widget.
Arranges candidates parallel to a generalised line representing the feature or parallel to a polygon'...
QgsTextFormat format() const
Returns the current formatting settings defined by the widget.
QgsExpressionContext * expressionContext() const
Returns the expression context used for the widget, if set.
void updatePreview()
Updates the text preview.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
~QgsTextFormatWidget() override
static bool fontFamilyMatchOnSystem(const QString &family, QString *chosen=nullptr, bool *match=nullptr)
Check whether font family is on system.
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object...
QgsMapUnitScale sizeMapUnitScale() const
Returns the map unit scale object for the size.
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units for the buffer size.
Points (e.g., for font sizes)
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units used for the shadow's offset.
bool enabled() const
Returns whether the shadow is enabled.
QgsTextFormatDialog(const QgsTextFormat &format, QgsMapCanvas *mapCanvas=nullptr, QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags, QgsVectorLayer *layer=nullptr)
Constructor for QgsTextFormatDialog.
QButtonGroup * mPlacePolygonBtnGrp
Polygon placement button group.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
Container for settings relating to a text shadow.
A collection of string replacements (specified using QgsStringReplacement objects).
bool offsetGlobal() const
Returns true if the global shadow offset will be used.
QColor color() const
Returns the color of the buffer.
double size() const
Returns the size of the buffer.
QgsUnitTypes::RenderUnit radiiUnit() const
Returns the units used for the shape's radii.
Container for settings relating to a text buffer.
static QString nameFromProperty(const QgsPropertyDefinition &def, bool joined=false)
Returns the name of the auxiliary field for a property definition.
void setFillColor(const QColor &color)
Sets the color used for filing the background shape.
QDialogButtonBox * buttonBox() const
Returns a reference to the dialog's button box.
static bool updateFontViaStyle(QFont &f, const QString &fontstyle, bool fallback=false)
Updates font with named style and retain all font properties.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
static QgsProject * instance()
Returns the QgsProject singleton instance.
double size() const
Returns the size for rendered text.
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit units)
Sets the units used for the shape's stroke width.
bool enabled() const
Returns whether the background is enabled.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the format's property collection, used for data defined overrides.
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
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...
int mMinPixelLimit
Pixel size font limit.
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
SizeType sizeType() const
Returns the method used to determine the size of the background shape (e.g., fixed size or buffer aro...
void setSubstitutions(const QgsStringReplacementCollection &substitutions)
Sets the list of substitutions to show in the dialog.
QgsUnitTypes::RenderUnit blurRadiusUnit() const
Returns the units used for the shadow's blur radius.
bool enabled() const
Returns whether the buffer is enabled.
int scale() const
Returns the scaling used for the drop shadow (in percentage of original size).
QSet< int > propertyKeys() const override
Returns a list of property keys contained within the collection.
Shape rotation is synced with text rotation.
QButtonGroup * mQuadrantBtnGrp
Quadrant button group.
void setShadowPlacement(QgsTextShadowSettings::ShadowPlacement placement)
Sets the placement for the drop shadow.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the text.
void setBuffer(const QgsTextBufferSettings &bufferSettings)
Sets the text's buffer settings.
Draw shadow under background shape.
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user...
Distance which labels can extend past either end of linear features.
void setShadow(const QgsTextShadowSettings &shadowSettings)
Sets the text's drop shadow settings.
A dialog which allows users to specify a list of substitutions to apply to a string, with options for exporting and importing substitution lists.
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the buffer.
QgsMapUnitScale sizeMapUnitScale() const
Returns the map unit scale object for the shape size.
static QString svgSymbolNameToPath(const QString &name, const QgsPathResolver &pathResolver)
Determines an SVG symbol's path from its name.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
Show upside down when rotation is layer- or data-defined.
Y-coordinate data defined label position.
void deactivateField(QgsPalLayerSettings::Property key)
Deactivate a field from data defined properties and update the corresponding button.
void updatePlacementWidgets()
Updates label placement options to reflect current state of widget.
Container for all settings relating to text rendering.
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units for the size of rendered text.
QgsMapCanvas * mMapCanvas
Associated map canvas.
bool contains(const QString &key, QgsSettings::Section section=QgsSettings::NoSection) const
Returns true if there exists a setting called key; returns false otherwise.
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the buffer.
bool addAuxiliaryField(const QgsPropertyDefinition &definition)
Adds an auxiliary field for the given property.
void setSvgFile(const QString &file)
Sets the path to the background SVG file.
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
bool blurAlphaOnly() const
Returns whether only the alpha channel for the shadow will be blurred.
void setOffsetGlobal(bool global)
Sets whether the global shadow offset should be used.
Represents a vector layer which manages a vector based data sets.
QButtonGroup * mPlacePointBtnGrp
Point placement button group.
Arranges candidates following the curvature of a polygon's boundary. Applies to polygon layers only...
void setOpacity(double opacity)
Sets the buffer opacity.
Square - buffered sizes only.
QgsStringReplacementCollection substitutions
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
Vertical alignment for data defined label position (Bottom, Base, Half, Cap, Top) ...
Whether all parts of multi-part features should be labeled.
QgsTextFormatWidget(const QgsTextFormat &format=QgsTextFormat(), QgsMapCanvas *mapCanvas=nullptr, QWidget *parent=nullptr, QgsVectorLayer *layer=nullptr)
Constructor for QgsTextFormatWidget.
QString namedStyle() const
Returns the named style for the font used for rendering text (e.g., "bold").
QFont font() const
Returns the font used for rendering text.
void setRotationType(RotationType type)
Sets the method used for rotating the background shape.
void setColor(const QColor &color)
Sets the color for the buffer.
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units used for the shape's size.
QButtonGroup * mDirectSymbBtnGrp
Symbol direction button group.
double opacity() const
Returns the shadow's opacity.
QgsMarkerSymbol * clone() const override
Returns a deep copy of this symbol.
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
QgsTextFormatPanelWidget(const QgsTextFormat &format, QgsMapCanvas *mapCanvas=nullptr, QWidget *parent=nullptr, QgsVectorLayer *layer=nullptr)
Constructor for QgsTextFormatPanelWidget.
void setOpacity(double opacity)
Sets the background shape's opacity.
QgsMarkerSymbol * markerSymbol() const
Returns the marker symbol to be rendered in the background.
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the background shape.
Horizontally oriented text.
QString resolvedFontFamily() const
Returns the family for the resolved font, ie if the specified font was not found on the system this w...
void setOffsetAngle(int angle)
Sets the angle for offsetting the position of the shadow from the text.
Arranges candidates scattered throughout a polygon feature. Candidates are rotated to respect the pol...
void setRotation(double rotation)
Sets the rotation for the background shape, in degrees clockwise.