QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgslabelinggui.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgslabelinggui.cpp
3  Smart labeling for vector layers
4  -------------------
5  begin : June 2009
6  copyright : (C) Martin Dobias
7  email : wonder dot sk at gmail dot com
8 
9  ***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "qgslabelinggui.h"
19 #include "qgsvectorlayer.h"
20 #include "qgsmapcanvas.h"
21 #include "qgsvectorlayerlabeling.h"
22 #include "qgsproject.h"
23 #include "qgsauxiliarystorage.h"
27 #include "qgshelp.h"
28 #include "qgsstylesavedialog.h"
29 #include "qgscallout.h"
30 #include "qgsapplication.h"
31 #include "qgscalloutsregistry.h"
34 #include <mutex>
35 
36 #include <QButtonGroup>
37 #include <QMessageBox>
38 
40 
41 QgsExpressionContext QgsLabelingGui::createExpressionContext() const
42 {
43  QgsExpressionContext expContext;
47  if ( mCanvas )
48  expContext << QgsExpressionContextUtils::mapSettingsScope( mCanvas->mapSettings() );
49 
50  if ( mLayer )
51  expContext << QgsExpressionContextUtils::layerScope( mLayer );
52 
54 
55  //TODO - show actual value
56  expContext.setOriginalValueVariable( QVariant() );
58 
59  return expContext;
60 }
61 
62 static bool _initCalloutWidgetFunction( const QString &name, QgsCalloutWidgetFunc f )
63 {
65 
66  QgsCalloutAbstractMetadata *abstractMetadata = registry->calloutMetadata( name );
67  if ( !abstractMetadata )
68  {
69  QgsDebugMsg( QStringLiteral( "Failed to find callout entry in registry: %1" ).arg( name ) );
70  return false;
71  }
72  QgsCalloutMetadata *metadata = dynamic_cast<QgsCalloutMetadata *>( abstractMetadata );
73  if ( !metadata )
74  {
75  QgsDebugMsg( QStringLiteral( "Failed to cast callout's metadata: " ) .arg( name ) );
76  return false;
77  }
78  metadata->setWidgetFunction( f );
79  return true;
80 }
81 
82 void QgsLabelingGui::initCalloutWidgets()
83 {
84  _initCalloutWidgetFunction( QStringLiteral( "simple" ), QgsSimpleLineCalloutWidget::create );
85  _initCalloutWidgetFunction( QStringLiteral( "manhattan" ), QgsManhattanLineCalloutWidget::create );
86 }
87 
88 void QgsLabelingGui::updateCalloutWidget( QgsCallout *callout )
89 {
90  if ( !callout )
91  {
92  mCalloutStackedWidget->setCurrentWidget( pageDummy );
93  return;
94  }
95 
96  if ( mCalloutStackedWidget->currentWidget() != pageDummy )
97  {
98  // stop updating from the original widget
99  if ( QgsCalloutWidget *pew = qobject_cast< QgsCalloutWidget * >( mCalloutStackedWidget->currentWidget() ) )
100  disconnect( pew, &QgsCalloutWidget::changed, this, &QgsLabelingGui::updatePreview );
101  }
102 
104  if ( QgsCalloutAbstractMetadata *am = registry->calloutMetadata( callout->type() ) )
105  {
106  if ( QgsCalloutWidget *w = am->createCalloutWidget( mLayer ) )
107  {
108 
109  QgsWkbTypes::GeometryType geometryType = mGeomType;
110  if ( mGeometryGeneratorGroupBox->isChecked() )
111  geometryType = mGeometryGeneratorType->currentData().value<QgsWkbTypes::GeometryType>();
112  else if ( mLayer )
113  geometryType = mLayer->geometryType();
114  w->setGeometryType( geometryType );
115  w->setCallout( callout );
116 
117  w->setContext( context() );
118  mCalloutStackedWidget->addWidget( w );
119  mCalloutStackedWidget->setCurrentWidget( w );
120  // start receiving updates from widget
121  connect( w, &QgsCalloutWidget::changed, this, &QgsLabelingGui::updatePreview );
122  return;
123  }
124  }
125  // When anything is not right
126  mCalloutStackedWidget->setCurrentWidget( pageDummy );
127 }
128 
129 void QgsLabelingGui::showObstacleSettings()
130 {
131  QgsExpressionContext context = createExpressionContext();
132 
133  QgsSymbolWidgetContext symbolContext;
134  symbolContext.setExpressionContext( &context );
135  symbolContext.setMapCanvas( mMapCanvas );
136 
137  QgsLabelObstacleSettingsWidget *widget = new QgsLabelObstacleSettingsWidget( nullptr, mLayer );
138  widget->setDataDefinedProperties( mDataDefinedProperties );
139  widget->setSettings( mObstacleSettings );
140  widget->setGeometryType( mLayer ? mLayer->geometryType() : QgsWkbTypes::UnknownGeometry );
141  widget->setContext( symbolContext );
142 
143  auto applySettings = [ = ]
144  {
145  mObstacleSettings = widget->settings();
146  const QgsPropertyCollection obstacleDataDefinedProperties = widget->dataDefinedProperties();
147  widget->updateDataDefinedProperties( mDataDefinedProperties );
148  emit widgetChanged();
149  };
150 
152  if ( panel && panel->dockMode() )
153  {
154  connect( widget, &QgsLabelSettingsWidgetBase::changed, this, [ = ]
155  {
156  applySettings();
157  } );
158  panel->openPanel( widget );
159  }
160  else
161  {
162  QgsLabelSettingsWidgetDialog dialog( widget, this );
163 
164  dialog.buttonBox()->addButton( QDialogButtonBox::Help );
165  connect( dialog.buttonBox(), &QDialogButtonBox::helpRequested, this, [ = ]
166  {
167  QgsHelp::openHelp( QStringLiteral( "style_library/label_settings.html#obstacles" ) );
168  } );
169 
170  if ( dialog.exec() )
171  {
172  applySettings();
173  }
174  // reactivate button's window
175  activateWindow();
176  }
177 }
178 
179 QgsLabelingGui::QgsLabelingGui( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const QgsPalLayerSettings &layerSettings, QWidget *parent, QgsWkbTypes::GeometryType geomType )
180  : QgsTextFormatWidget( mapCanvas, parent, QgsTextFormatWidget::Labeling, layer )
181  , mGeomType( geomType )
182  , mSettings( layerSettings )
183  , mMode( NoLabels )
184  , mCanvas( mapCanvas )
185 {
186  static std::once_flag initialized;
187  std::call_once( initialized, [ = ]( )
188  {
189  initCalloutWidgets();
190  } );
191 
192  mFontMultiLineAlignComboBox->addItem( tr( "Left" ), QgsPalLayerSettings::MultiLeft );
193  mFontMultiLineAlignComboBox->addItem( tr( "Center" ), QgsPalLayerSettings::MultiCenter );
194  mFontMultiLineAlignComboBox->addItem( tr( "Right" ), QgsPalLayerSettings::MultiRight );
195 
196  // connections for groupboxes with separate activation checkboxes (that need to honor data defined setting)
197  connect( mBufferDrawChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
198  connect( mEnableMaskChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
199  connect( mShapeDrawChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
200  connect( mCalloutsDrawCheckBox, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
201  connect( mShadowDrawChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
202  connect( mDirectSymbChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
203  connect( mFormatNumChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
204  connect( mScaleBasedVisibilityChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
205  connect( mFontLimitPixelChkBox, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
206  connect( mGeometryGeneratorGroupBox, &QGroupBox::toggled, this, &QgsLabelingGui::updateGeometryTypeBasedWidgets );
207  connect( mGeometryGeneratorType, qgis::overload<int>::of( &QComboBox::currentIndexChanged ), this, &QgsLabelingGui::updateGeometryTypeBasedWidgets );
208  connect( mGeometryGeneratorExpressionButton, &QToolButton::clicked, this, &QgsLabelingGui::showGeometryGeneratorExpressionBuilder );
209  connect( mGeometryGeneratorGroupBox, &QGroupBox::toggled, this, &QgsLabelingGui::validateGeometryGeneratorExpression );
210  connect( mGeometryGenerator, &QgsCodeEditorExpression::textChanged, this, &QgsLabelingGui::validateGeometryGeneratorExpression );
211  connect( mGeometryGeneratorType, qgis::overload<int>::of( &QComboBox::currentIndexChanged ), this, &QgsLabelingGui::validateGeometryGeneratorExpression );
212  connect( mObstacleSettingsButton, &QAbstractButton::clicked, this, &QgsLabelingGui::showObstacleSettings );
213 
214  mFieldExpressionWidget->registerExpressionContextGenerator( this );
215 
216  mMinScaleWidget->setMapCanvas( mCanvas );
217  mMinScaleWidget->setShowCurrentScaleButton( true );
218  mMaxScaleWidget->setMapCanvas( mCanvas );
219  mMaxScaleWidget->setShowCurrentScaleButton( true );
220 
221  const QStringList calloutTypes = QgsApplication::calloutRegistry()->calloutTypes();
222  for ( const QString &type : calloutTypes )
223  {
224  mCalloutStyleComboBox->addItem( QgsApplication::calloutRegistry()->calloutMetadata( type )->icon(),
225  QgsApplication::calloutRegistry()->calloutMetadata( type )->visibleName(), type );
226  }
227 
228  mGeometryGeneratorWarningLabel->setStyleSheet( QStringLiteral( "color: #FFC107;" ) );
229  mGeometryGeneratorWarningLabel->setTextInteractionFlags( Qt::TextBrowserInteraction );
230  connect( mGeometryGeneratorWarningLabel, &QLabel::linkActivated, this, [this]( const QString & link )
231  {
232  if ( link == QLatin1String( "#determineGeometryGeneratorType" ) )
233  determineGeometryGeneratorType();
234  } );
235 
236  connect( mCalloutStyleComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLabelingGui::calloutTypeChanged );
237 
238  setLayer( layer );
239 }
240 
241 void QgsLabelingGui::setLayer( QgsMapLayer *mapLayer )
242 {
243  mPreviewFeature = QgsFeature();
244 
245  if ( ( !mapLayer || mapLayer->type() != QgsMapLayerType::VectorLayer ) && mGeomType == QgsWkbTypes::UnknownGeometry )
246  {
247  setEnabled( false );
248  return;
249  }
250 
251  setEnabled( true );
252 
253  QgsVectorLayer *layer = static_cast<QgsVectorLayer *>( mapLayer );
254  mLayer = layer;
255 
256  mTextFormatsListWidget->setLayerType( mLayer ? mLayer->geometryType() : mGeomType );
257  mBackgroundSymbolButton->setLayer( mLayer );
258 
259  // load labeling settings from layer
260  updateGeometryTypeBasedWidgets();
261 
262  mFieldExpressionWidget->setLayer( mLayer );
263  QgsDistanceArea da;
264  if ( mLayer )
265  da.setSourceCrs( mLayer->crs(), QgsProject::instance()->transformContext() );
266  da.setEllipsoid( QgsProject::instance()->ellipsoid() );
267  mFieldExpressionWidget->setGeomCalculator( da );
268 
269  mFieldExpressionWidget->setEnabled( mMode == Labels || !mLayer );
270  mLabelingFrame->setEnabled( mMode == Labels || !mLayer );
271 
272  blockInitSignals( true );
273 
274  mGeometryGenerator->setText( mSettings.geometryGenerator );
275  mGeometryGeneratorGroupBox->setChecked( mSettings.geometryGeneratorEnabled );
276  mGeometryGeneratorType->setCurrentIndex( mGeometryGeneratorType->findData( mSettings.geometryGeneratorType ) );
277 
278  updateWidgetForFormat( mSettings.format() );
279 
280  mFieldExpressionWidget->setRow( -1 );
281  mFieldExpressionWidget->setField( mSettings.fieldName );
282  mCheckBoxSubstituteText->setChecked( mSettings.useSubstitutions );
283  mSubstitutions = mSettings.substitutions;
284 
285  // populate placement options
286  mCentroidRadioWhole->setChecked( mSettings.centroidWhole );
287  mCentroidInsideCheckBox->setChecked( mSettings.centroidInside );
288  mFitInsidePolygonCheckBox->setChecked( mSettings.fitInPolygonOnly );
289  mLineDistanceSpnBx->setValue( mSettings.dist );
290  mLineDistanceUnitWidget->setUnit( mSettings.distUnits );
291  mLineDistanceUnitWidget->setMapUnitScale( mSettings.distMapUnitScale );
292  mOffsetTypeComboBox->setCurrentIndex( mOffsetTypeComboBox->findData( mSettings.offsetType ) );
293  mQuadrantBtnGrp->button( static_cast<int>( mSettings.quadOffset ) )->setChecked( true );
294  mPointOffsetXSpinBox->setValue( mSettings.xOffset );
295  mPointOffsetYSpinBox->setValue( mSettings.yOffset );
296  mPointOffsetUnitWidget->setUnit( mSettings.offsetUnits );
297  mPointOffsetUnitWidget->setMapUnitScale( mSettings.labelOffsetMapUnitScale );
298  mPointAngleSpinBox->setValue( mSettings.angleOffset );
299  chkLineAbove->setChecked( mSettings.placementFlags & QgsPalLayerSettings::AboveLine );
300  chkLineBelow->setChecked( mSettings.placementFlags & QgsPalLayerSettings::BelowLine );
301  chkLineOn->setChecked( mSettings.placementFlags & QgsPalLayerSettings::OnLine );
302  chkLineOrientationDependent->setChecked( !( mSettings.placementFlags & QgsPalLayerSettings::MapOrientation ) );
303 
304  mCheckAllowLabelsOutsidePolygons->setChecked( mSettings.polygonPlacementFlags() & QgsLabeling::PolygonPlacementFlag::AllowPlacementOutsideOfPolygon );
305 
306  switch ( mSettings.placement )
307  {
309  radAroundPoint->setChecked( true );
310  radAroundCentroid->setChecked( true );
311  //spinAngle->setValue( lyr.angle ); // TODO: uncomment when supported
312  break;
314  radOverPoint->setChecked( true );
315  radOverCentroid->setChecked( true );
316  break;
318  radPredefinedOrder->setChecked( true );
319  break;
321  radLineParallel->setChecked( true );
322  radPolygonPerimeter->setChecked( true );
323  break;
325  radLineCurved->setChecked( true );
326  break;
328  radPolygonHorizontal->setChecked( true );
329  radLineHorizontal->setChecked( true );
330  break;
332  radPolygonFree->setChecked( true );
333  break;
335  radPolygonPerimeterCurved->setChecked( true );
336  break;
338  radPolygonOutside->setChecked( true );
339  break;
340  }
341 
342  // Label repeat distance
343  mRepeatDistanceSpinBox->setValue( mSettings.repeatDistance );
344  mRepeatDistanceUnitWidget->setUnit( mSettings.repeatDistanceUnit );
345  mRepeatDistanceUnitWidget->setMapUnitScale( mSettings.repeatDistanceMapUnitScale );
346 
347  mOverrunDistanceSpinBox->setValue( mSettings.overrunDistance );
348  mOverrunDistanceUnitWidget->setUnit( mSettings.overrunDistanceUnit );
349  mOverrunDistanceUnitWidget->setMapUnitScale( mSettings.overrunDistanceMapUnitScale );
350 
351  mPrioritySlider->setValue( mSettings.priority );
352  mChkNoObstacle->setChecked( mSettings.obstacleSettings().isObstacle() );
353 
354  mObstacleSettings = mSettings.obstacleSettings();
355 
356  chkLabelPerFeaturePart->setChecked( mSettings.labelPerPart );
357  mPalShowAllLabelsForLayerChkBx->setChecked( mSettings.displayAll );
358  chkMergeLines->setChecked( mSettings.mergeLines );
359  mMinSizeSpinBox->setValue( mSettings.thinningSettings().minimumFeatureSize() );
360  mLimitLabelChkBox->setChecked( mSettings.thinningSettings().limitNumberOfLabelsEnabled() );
361  mLimitLabelSpinBox->setValue( mSettings.thinningSettings().maximumNumberLabels() );
362 
363  // direction symbol(s)
364  mDirectSymbChkBx->setChecked( mSettings.addDirectionSymbol );
365  mDirectSymbLeftLineEdit->setText( mSettings.leftDirectionSymbol );
366  mDirectSymbRightLineEdit->setText( mSettings.rightDirectionSymbol );
367  mDirectSymbRevChkBx->setChecked( mSettings.reverseDirectionSymbol );
368 
369  mDirectSymbBtnGrp->button( static_cast<int>( mSettings.placeDirectionSymbol ) )->setChecked( true );
370  mUpsidedownBtnGrp->button( static_cast<int>( mSettings.upsidedownLabels ) )->setChecked( true );
371 
372  // curved label max character angles
373  mMaxCharAngleInDSpinBox->setValue( mSettings.maxCurvedCharAngleIn );
374  // lyr.maxCurvedCharAngleOut must be negative, but it is shown as positive spinbox in GUI
375  mMaxCharAngleOutDSpinBox->setValue( std::fabs( mSettings.maxCurvedCharAngleOut ) );
376 
377  wrapCharacterEdit->setText( mSettings.wrapChar );
378  mAutoWrapLengthSpinBox->setValue( mSettings.autoWrapLength );
379  mAutoWrapTypeComboBox->setCurrentIndex( mSettings.useMaxLineLengthForAutoWrap ? 0 : 1 );
380 
381  if ( mFontMultiLineAlignComboBox->findData( mSettings.multilineAlign ) != -1 )
382  {
383  mFontMultiLineAlignComboBox->setCurrentIndex( mFontMultiLineAlignComboBox->findData( mSettings.multilineAlign ) );
384  }
385  else
386  {
387  // the default pal layer settings for multiline alignment is to follow label placement, which isn't always available
388  // revert to left alignment in such case
389  mFontMultiLineAlignComboBox->setCurrentIndex( 0 );
390  }
391 
392  chkPreserveRotation->setChecked( mSettings.preserveRotation );
393 
394  mScaleBasedVisibilityChkBx->setChecked( mSettings.scaleVisibility );
395  mMinScaleWidget->setScale( mSettings.minimumScale );
396  mMaxScaleWidget->setScale( mSettings.maximumScale );
397 
398  mFormatNumChkBx->setChecked( mSettings.formatNumbers );
399  mFormatNumDecimalsSpnBx->setValue( mSettings.decimals );
400  mFormatNumPlusSignChkBx->setChecked( mSettings.plusSign );
401 
402  // set pixel size limiting checked state before unit choice so limiting can be
403  // turned on as a default for map units, if minimum trigger value of 0 is used
404  mFontLimitPixelChkBox->setChecked( mSettings.fontLimitPixelSize );
405  mMinPixelLimit = mSettings.fontMinPixelSize; // ignored after first settings save
406  mFontMinPixelSpinBox->setValue( mSettings.fontMinPixelSize == 0 ? 3 : mSettings.fontMinPixelSize );
407  mFontMaxPixelSpinBox->setValue( mSettings.fontMaxPixelSize );
408 
409  mZIndexSpinBox->setValue( mSettings.zIndex );
410 
411  mDataDefinedProperties = mSettings.dataDefinedProperties();
412 
413  // callout settings, to move to custom widget when multiple styles exist
414  if ( mSettings.callout() )
415  {
416  whileBlocking( mCalloutsDrawCheckBox )->setChecked( mSettings.callout()->enabled() );
417  whileBlocking( mCalloutStyleComboBox )->setCurrentIndex( mCalloutStyleComboBox->findData( mSettings.callout()->type() ) );
418  updateCalloutWidget( mSettings.callout() );
419  }
420  else
421  {
422  std::unique_ptr< QgsCallout > defaultCallout( QgsApplication::calloutRegistry()->defaultCallout() );
423  whileBlocking( mCalloutStyleComboBox )->setCurrentIndex( mCalloutStyleComboBox->findData( defaultCallout->type() ) );
424  whileBlocking( mCalloutsDrawCheckBox )->setChecked( false );
425  updateCalloutWidget( defaultCallout.get() );
426  }
427 
428  updatePlacementWidgets();
429  updateLinePlacementOptions();
430 
431  // needs to come before data defined setup, so connections work
432  blockInitSignals( false );
433 
434  // set up data defined toolbuttons
435  // do this after other widgets are configured, so they can be enabled/disabled
436  populateDataDefinedButtons();
437 
438  enableDataDefinedAlignment( mCoordXDDBtn->isActive() && mCoordYDDBtn->isActive() );
439  updateUi(); // should come after data defined button setup
440 }
441 
442 void QgsLabelingGui::setSettings( const QgsPalLayerSettings &settings )
443 {
444  mSettings = settings;
445  setLayer( mLayer );
446 }
447 
448 void QgsLabelingGui::blockInitSignals( bool block )
449 {
450  chkLineAbove->blockSignals( block );
451  chkLineBelow->blockSignals( block );
452  mPlacePointBtnGrp->blockSignals( block );
453  mPlaceLineBtnGrp->blockSignals( block );
454  mPlacePolygonBtnGrp->blockSignals( block );
455 }
456 
457 void QgsLabelingGui::setLabelMode( LabelMode mode )
458 {
459  mMode = mode;
460  mFieldExpressionWidget->setEnabled( mMode == Labels );
461  mLabelingFrame->setEnabled( mMode == Labels );
462 }
463 
464 QgsPalLayerSettings QgsLabelingGui::layerSettings()
465 {
467 
468  lyr.drawLabels = ( mMode == Labels ) || !mLayer;
469 
470  bool isExpression;
471  lyr.fieldName = mFieldExpressionWidget->currentField( &isExpression );
472  lyr.isExpression = isExpression;
473 
474  lyr.dist = 0;
475  lyr.placementFlags = 0;
476 
477  QgsLabeling::PolygonPlacementFlags polygonPlacementFlags = QgsLabeling::PolygonPlacementFlag::AllowPlacementInsideOfPolygon;
478  if ( mCheckAllowLabelsOutsidePolygons->isChecked() )
479  polygonPlacementFlags |= QgsLabeling::PolygonPlacementFlag::AllowPlacementOutsideOfPolygon;
480  lyr.setPolygonPlacementFlags( polygonPlacementFlags );
481 
482  QWidget *curPlacementWdgt = stackedPlacement->currentWidget();
483  lyr.centroidWhole = mCentroidRadioWhole->isChecked();
484  lyr.centroidInside = mCentroidInsideCheckBox->isChecked();
485  lyr.fitInPolygonOnly = mFitInsidePolygonCheckBox->isChecked();
486  lyr.dist = mLineDistanceSpnBx->value();
487  lyr.distUnits = mLineDistanceUnitWidget->unit();
488  lyr.distMapUnitScale = mLineDistanceUnitWidget->getMapUnitScale();
489  lyr.offsetType = static_cast< QgsPalLayerSettings::OffsetType >( mOffsetTypeComboBox->currentData().toInt() );
490  if ( mQuadrantBtnGrp )
491  {
492  lyr.quadOffset = ( QgsPalLayerSettings::QuadrantPosition )mQuadrantBtnGrp->checkedId();
493  }
494  lyr.xOffset = mPointOffsetXSpinBox->value();
495  lyr.yOffset = mPointOffsetYSpinBox->value();
496  lyr.offsetUnits = mPointOffsetUnitWidget->unit();
497  lyr.labelOffsetMapUnitScale = mPointOffsetUnitWidget->getMapUnitScale();
498  lyr.angleOffset = mPointAngleSpinBox->value();
499  if ( chkLineAbove->isChecked() )
501  if ( chkLineBelow->isChecked() )
503  if ( chkLineOn->isChecked() )
505  if ( ! chkLineOrientationDependent->isChecked() )
507  if ( ( curPlacementWdgt == pagePoint && radAroundPoint->isChecked() )
508  || ( curPlacementWdgt == pagePolygon && radAroundCentroid->isChecked() ) )
509  {
511  }
512  else if ( ( curPlacementWdgt == pagePoint && radOverPoint->isChecked() )
513  || ( curPlacementWdgt == pagePolygon && radOverCentroid->isChecked() ) )
514  {
516  }
517  else if ( curPlacementWdgt == pagePoint && radPredefinedOrder->isChecked() )
518  {
520  }
521  else if ( ( curPlacementWdgt == pageLine && radLineParallel->isChecked() )
522  || ( curPlacementWdgt == pagePolygon && radPolygonPerimeter->isChecked() ) )
523  {
525  }
526  else if ( curPlacementWdgt == pageLine && radLineCurved->isChecked() )
527  {
529  }
530  else if ( curPlacementWdgt == pagePolygon && radPolygonPerimeterCurved->isChecked() )
531  {
533  }
534  else if ( ( curPlacementWdgt == pageLine && radLineHorizontal->isChecked() )
535  || ( curPlacementWdgt == pagePolygon && radPolygonHorizontal->isChecked() ) )
536  {
538  }
539  else if ( radPolygonFree->isChecked() )
540  {
542  }
543  else if ( radPolygonOutside->isChecked() )
544  {
546  }
547  else
548  {
549  qFatal( "Invalid settings" );
550  }
551 
552  lyr.repeatDistance = mRepeatDistanceSpinBox->value();
553  lyr.repeatDistanceUnit = mRepeatDistanceUnitWidget->unit();
554  lyr.repeatDistanceMapUnitScale = mRepeatDistanceUnitWidget->getMapUnitScale();
555 
556  lyr.overrunDistance = mOverrunDistanceSpinBox->value();
557  lyr.overrunDistanceUnit = mOverrunDistanceUnitWidget->unit();
558  lyr.overrunDistanceMapUnitScale = mOverrunDistanceUnitWidget->getMapUnitScale();
559 
560  lyr.priority = mPrioritySlider->value();
561 
562  mObstacleSettings.setIsObstacle( mChkNoObstacle->isChecked() || mMode == ObstaclesOnly );
563  lyr.setObstacleSettings( mObstacleSettings );
564 
565  lyr.labelPerPart = chkLabelPerFeaturePart->isChecked();
566  lyr.displayAll = mPalShowAllLabelsForLayerChkBx->isChecked();
567  lyr.mergeLines = chkMergeLines->isChecked();
568 
569  lyr.scaleVisibility = mScaleBasedVisibilityChkBx->isChecked();
570  lyr.minimumScale = mMinScaleWidget->scale();
571  lyr.maximumScale = mMaxScaleWidget->scale();
572  lyr.useSubstitutions = mCheckBoxSubstituteText->isChecked();
573  lyr.substitutions = mSubstitutions;
574 
575  lyr.setFormat( format( false ) );
576 
577  // format numbers
578  lyr.formatNumbers = mFormatNumChkBx->isChecked();
579  lyr.decimals = mFormatNumDecimalsSpnBx->value();
580  lyr.plusSign = mFormatNumPlusSignChkBx->isChecked();
581 
582  // direction symbol(s)
583  lyr.addDirectionSymbol = mDirectSymbChkBx->isChecked();
584  lyr.leftDirectionSymbol = mDirectSymbLeftLineEdit->text();
585  lyr.rightDirectionSymbol = mDirectSymbRightLineEdit->text();
586  lyr.reverseDirectionSymbol = mDirectSymbRevChkBx->isChecked();
587  if ( mDirectSymbBtnGrp )
588  {
589  lyr.placeDirectionSymbol = ( QgsPalLayerSettings::DirectionSymbols )mDirectSymbBtnGrp->checkedId();
590  }
591  if ( mUpsidedownBtnGrp )
592  {
593  lyr.upsidedownLabels = ( QgsPalLayerSettings::UpsideDownLabels )mUpsidedownBtnGrp->checkedId();
594  }
595 
596  lyr.maxCurvedCharAngleIn = mMaxCharAngleInDSpinBox->value();
597  // lyr.maxCurvedCharAngleOut must be negative, but it is shown as positive spinbox in GUI
598  lyr.maxCurvedCharAngleOut = -mMaxCharAngleOutDSpinBox->value();
599 
600 
601  lyr.thinningSettings().setMinimumFeatureSize( mMinSizeSpinBox->value() );
602  lyr.thinningSettings().setLimitNumberLabelsEnabled( mLimitLabelChkBox->isChecked() );
603  lyr.thinningSettings().setMaximumNumberLabels( mLimitLabelSpinBox->value() );
604  lyr.fontLimitPixelSize = mFontLimitPixelChkBox->isChecked();
605  lyr.fontMinPixelSize = mFontMinPixelSpinBox->value();
606  lyr.fontMaxPixelSize = mFontMaxPixelSpinBox->value();
607  lyr.wrapChar = wrapCharacterEdit->text();
608  lyr.autoWrapLength = mAutoWrapLengthSpinBox->value();
609  lyr.useMaxLineLengthForAutoWrap = mAutoWrapTypeComboBox->currentIndex() == 0;
610  lyr.multilineAlign = static_cast< QgsPalLayerSettings::MultiLineAlign >( mFontMultiLineAlignComboBox->currentData().toInt() );
611  lyr.preserveRotation = chkPreserveRotation->isChecked();
612  lyr.geometryGenerator = mGeometryGenerator->text();
613  lyr.geometryGeneratorType = mGeometryGeneratorType->currentData().value<QgsWkbTypes::GeometryType>();
614  lyr.geometryGeneratorEnabled = mGeometryGeneratorGroupBox->isChecked();
615 
616  lyr.layerType = mLayer ? mLayer->geometryType() : mGeomType;
617 
618  lyr.zIndex = mZIndexSpinBox->value();
619 
620  lyr.setDataDefinedProperties( mDataDefinedProperties );
621 
622  // callout settings
623  const QString calloutType = mCalloutStyleComboBox->currentData().toString();
624  std::unique_ptr< QgsCallout > callout;
625  if ( QgsCalloutWidget *pew = qobject_cast< QgsCalloutWidget * >( mCalloutStackedWidget->currentWidget() ) )
626  {
627  callout.reset( pew->callout()->clone() );
628  }
629  if ( !callout )
630  callout.reset( QgsApplication::calloutRegistry()->createCallout( calloutType ) );
631 
632  callout->setEnabled( mCalloutsDrawCheckBox->isChecked() );
633  lyr.setCallout( callout.release() );
634 
635  return lyr;
636 }
637 
638 void QgsLabelingGui::syncDefinedCheckboxFrame( QgsPropertyOverrideButton *ddBtn, QCheckBox *chkBx, QFrame *f )
639 {
640  if ( ddBtn->isActive() && !chkBx->isChecked() )
641  {
642  chkBx->setChecked( true );
643  }
644  f->setEnabled( chkBx->isChecked() );
645 }
646 
647 void QgsLabelingGui::updateUi()
648 {
649  // enable/disable inline groupbox-like setups (that need to honor data defined setting)
650 
651  syncDefinedCheckboxFrame( mBufferDrawDDBtn, mBufferDrawChkBx, mBufferFrame );
652  syncDefinedCheckboxFrame( mEnableMaskDDBtn, mEnableMaskChkBx, mMaskFrame );
653  syncDefinedCheckboxFrame( mShapeDrawDDBtn, mShapeDrawChkBx, mShapeFrame );
654  syncDefinedCheckboxFrame( mShadowDrawDDBtn, mShadowDrawChkBx, mShadowFrame );
655  syncDefinedCheckboxFrame( mCalloutDrawDDBtn, mCalloutsDrawCheckBox, mCalloutFrame );
656 
657  syncDefinedCheckboxFrame( mDirectSymbDDBtn, mDirectSymbChkBx, mDirectSymbFrame );
658  syncDefinedCheckboxFrame( mFormatNumDDBtn, mFormatNumChkBx, mFormatNumFrame );
659  syncDefinedCheckboxFrame( mScaleBasedVisibilityDDBtn, mScaleBasedVisibilityChkBx, mScaleBasedVisibilityFrame );
660  syncDefinedCheckboxFrame( mFontLimitPixelDDBtn, mFontLimitPixelChkBox, mFontLimitPixelFrame );
661 
662  chkMergeLines->setEnabled( !mDirectSymbChkBx->isChecked() );
663  if ( mDirectSymbChkBx->isChecked() )
664  {
665  chkMergeLines->setToolTip( tr( "This option is not compatible with line direction symbols." ) );
666  }
667  else
668  {
669  chkMergeLines->setToolTip( QString() );
670  }
671 }
672 
673 void QgsLabelingGui::setFormatFromStyle( const QString &name, QgsStyle::StyleEntity type )
674 {
675  switch ( type )
676  {
679  case QgsStyle::TagEntity:
683  {
685  return;
686  }
687 
689  {
690  if ( !QgsStyle::defaultStyle()->labelSettingsNames().contains( name ) )
691  return;
692 
694  if ( settings.fieldName.isEmpty() )
695  {
696  // if saved settings doesn't have a field name stored, retain the current one
697  bool isExpression;
698  settings.fieldName = mFieldExpressionWidget->currentField( &isExpression );
699  settings.isExpression = isExpression;
700  }
701  setSettings( settings );
702  break;
703  }
704  }
705 }
706 
707 void QgsLabelingGui::setContext( const QgsSymbolWidgetContext &context )
708 {
709  if ( QgsCalloutWidget *cw = qobject_cast< QgsCalloutWidget * >( mCalloutStackedWidget->currentWidget() ) )
710  {
711  cw->setContext( context );
712  }
714 }
715 
716 void QgsLabelingGui::saveFormat()
717 {
718  QgsStyle *style = QgsStyle::defaultStyle();
719  if ( !style )
720  return;
721 
722  QgsStyleSaveDialog saveDlg( this, QgsStyle::LabelSettingsEntity );
723  saveDlg.setDefaultTags( mTextFormatsListWidget->currentTagFilter() );
724  if ( !saveDlg.exec() )
725  return;
726 
727  if ( saveDlg.name().isEmpty() )
728  return;
729 
730  switch ( saveDlg.selectedType() )
731  {
733  {
734  // check if there is no format with same name
735  if ( style->textFormatNames().contains( saveDlg.name() ) )
736  {
737  int res = QMessageBox::warning( this, tr( "Save Text Format" ),
738  tr( "Format with name '%1' already exists. Overwrite?" )
739  .arg( saveDlg.name() ),
740  QMessageBox::Yes | QMessageBox::No );
741  if ( res != QMessageBox::Yes )
742  {
743  return;
744  }
745  style->removeTextFormat( saveDlg.name() );
746  }
747  QStringList symbolTags = saveDlg.tags().split( ',' );
748 
749  QgsTextFormat newFormat = format();
750  style->addTextFormat( saveDlg.name(), newFormat );
751  style->saveTextFormat( saveDlg.name(), newFormat, saveDlg.isFavorite(), symbolTags );
752  break;
753  }
754 
756  {
757  // check if there is no settings with same name
758  if ( style->labelSettingsNames().contains( saveDlg.name() ) )
759  {
760  int res = QMessageBox::warning( this, tr( "Save Label Settings" ),
761  tr( "Label settings with the name '%1' already exist. Overwrite?" )
762  .arg( saveDlg.name() ),
763  QMessageBox::Yes | QMessageBox::No );
764  if ( res != QMessageBox::Yes )
765  {
766  return;
767  }
768  style->removeLabelSettings( saveDlg.name() );
769  }
770  QStringList symbolTags = saveDlg.tags().split( ',' );
771 
772  QgsPalLayerSettings newSettings = layerSettings();
773  style->addLabelSettings( saveDlg.name(), newSettings );
774  style->saveLabelSettings( saveDlg.name(), newSettings, saveDlg.isFavorite(), symbolTags );
775  break;
776  }
777 
780  case QgsStyle::TagEntity:
783  break;
784  }
785 }
786 
787 void QgsLabelingGui::updateGeometryTypeBasedWidgets()
788 {
789  QgsWkbTypes::GeometryType geometryType = mGeomType;
790 
791  if ( mGeometryGeneratorGroupBox->isChecked() )
792  geometryType = mGeometryGeneratorType->currentData().value<QgsWkbTypes::GeometryType>();
793  else if ( mLayer )
794  geometryType = mLayer->geometryType();
795 
796  // show/hide options based upon geometry type
797  chkMergeLines->setVisible( geometryType == QgsWkbTypes::LineGeometry );
798  mDirectSymbolsFrame->setVisible( geometryType == QgsWkbTypes::LineGeometry );
799  mMinSizeFrame->setVisible( geometryType != QgsWkbTypes::PointGeometry );
800  mPolygonFeatureOptionsFrame->setVisible( geometryType == QgsWkbTypes::PolygonGeometry );
801 
802 
803  // set placement methods page based on geometry type
804  switch ( geometryType )
805  {
807  stackedPlacement->setCurrentWidget( pagePoint );
808  break;
810  stackedPlacement->setCurrentWidget( pageLine );
811  break;
813  stackedPlacement->setCurrentWidget( pagePolygon );
814  break;
816  break;
818  qFatal( "unknown geometry type unexpected" );
819  }
820 
821  if ( geometryType == QgsWkbTypes::PointGeometry || geometryType == QgsWkbTypes::PolygonGeometry )
822  {
823  // follow placement alignment is only valid for point or polygon layers
824  if ( mFontMultiLineAlignComboBox->findData( QgsPalLayerSettings::MultiFollowPlacement ) == -1 )
825  mFontMultiLineAlignComboBox->addItem( tr( "Follow Label Placement" ), QgsPalLayerSettings::MultiFollowPlacement );
826  }
827  else
828  {
829  int idx = mFontMultiLineAlignComboBox->findData( QgsPalLayerSettings::MultiFollowPlacement );
830  if ( idx >= 0 )
831  mFontMultiLineAlignComboBox->removeItem( idx );
832  }
833 
834  updatePlacementWidgets();
835  updateLinePlacementOptions();
836 }
837 
838 void QgsLabelingGui::showGeometryGeneratorExpressionBuilder()
839 {
840  QgsExpressionBuilderDialog expressionBuilder( mLayer );
841 
842  expressionBuilder.setExpressionText( mGeometryGenerator->text() );
843  expressionBuilder.setExpressionContext( createExpressionContext() );
844 
845  if ( expressionBuilder.exec() )
846  {
847  mGeometryGenerator->setText( expressionBuilder.expressionText() );
848  }
849 }
850 
851 void QgsLabelingGui::validateGeometryGeneratorExpression()
852 {
853  bool valid = true;
854 
855  if ( mGeometryGeneratorGroupBox->isChecked() )
856  {
857  if ( !mPreviewFeature.isValid() && mLayer )
858  mLayer->getFeatures( QgsFeatureRequest().setLimit( 1 ) ).nextFeature( mPreviewFeature );
859 
860  QgsExpression expression( mGeometryGenerator->text() );
861  QgsExpressionContext context = createExpressionContext();
862  context.setFeature( mPreviewFeature );
863 
864  expression.prepare( &context );
865 
866  if ( expression.hasParserError() )
867  {
868  mGeometryGeneratorWarningLabel->setText( expression.parserErrorString() );
869  valid = false;
870  }
871  else
872  {
873  const QVariant result = expression.evaluate( &context );
874  const QgsGeometry geometry = result.value<QgsGeometry>();
875  QgsWkbTypes::GeometryType configuredGeometryType = mGeometryGeneratorType->currentData().value<QgsWkbTypes::GeometryType>();
876  if ( geometry.isNull() )
877  {
878  mGeometryGeneratorWarningLabel->setText( tr( "Result of the expression is not a geometry" ) );
879  valid = false;
880  }
881  else if ( geometry.type() != configuredGeometryType )
882  {
883  mGeometryGeneratorWarningLabel->setText( QStringLiteral( "<p>%1</p><p><a href=\"#determineGeometryGeneratorType\">%2</a></p>" ).arg(
884  tr( "Result of the expression does not match configured geometry type." ),
885  tr( "Change to %1" ).arg( QgsWkbTypes::geometryDisplayString( geometry.type() ) ) ) );
886  valid = false;
887  }
888  }
889  }
890 
891  // The collapsible groupbox internally changes the visibility of this
892  // Work around by setting the visibility deferred in the next event loop cycle.
893  QTimer *timer = new QTimer();
894  connect( timer, &QTimer::timeout, this, [this, valid]()
895  {
896  mGeometryGeneratorWarningLabel->setVisible( !valid );
897  } );
898  connect( timer, &QTimer::timeout, timer, &QTimer::deleteLater );
899  timer->start( 0 );
900 }
901 
902 void QgsLabelingGui::determineGeometryGeneratorType()
903 {
904  if ( !mPreviewFeature.isValid() && mLayer )
905  mLayer->getFeatures( QgsFeatureRequest().setLimit( 1 ) ).nextFeature( mPreviewFeature );
906 
907  QgsExpression expression( mGeometryGenerator->text() );
908  QgsExpressionContext context = createExpressionContext();
909  context.setFeature( mPreviewFeature );
910 
911  expression.prepare( &context );
912  const QgsGeometry geometry = expression.evaluate( &context ).value<QgsGeometry>();
913 
914  mGeometryGeneratorType->setCurrentIndex( mGeometryGeneratorType->findData( geometry.type() ) );
915 }
916 
917 void QgsLabelingGui::calloutTypeChanged()
918 {
919  QString newCalloutType = mCalloutStyleComboBox->currentData().toString();
920  QgsCalloutWidget *pew = qobject_cast< QgsCalloutWidget * >( mCalloutStackedWidget->currentWidget() );
921  if ( pew )
922  {
923  if ( pew->callout() && pew->callout()->type() == newCalloutType )
924  return;
925  }
926 
927  // get creation function for new callout from registry
929  QgsCalloutAbstractMetadata *am = registry->calloutMetadata( newCalloutType );
930  if ( !am ) // check whether the metadata is assigned
931  return;
932 
933  // change callout to a new one (with different type)
934  // base new callout on existing callout's properties
935  std::unique_ptr< QgsCallout > newCallout( am->createCallout( pew && pew->callout() ? pew->callout()->properties( QgsReadWriteContext() ) : QVariantMap(), QgsReadWriteContext() ) );
936  if ( !newCallout )
937  return;
938 
939  updateCalloutWidget( newCallout.get() );
940  updatePreview();
941 }
942 
943 
944 //
945 // QgsLabelSettingsDialog
946 //
947 
948 QgsLabelSettingsDialog::QgsLabelSettingsDialog( const QgsPalLayerSettings &settings, QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, QWidget *parent,
949  QgsWkbTypes::GeometryType geomType )
950  : QDialog( parent )
951 {
952  QVBoxLayout *vLayout = new QVBoxLayout();
953  mWidget = new QgsLabelingGui( layer, mapCanvas, settings, nullptr, geomType );
954  vLayout->addWidget( mWidget );
955  mButtonBox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok, Qt::Horizontal );
956  connect( mButtonBox, &QDialogButtonBox::accepted, this, &QDialog::accept );
957  connect( mButtonBox, &QDialogButtonBox::rejected, this, &QDialog::reject );
958  connect( mButtonBox, &QDialogButtonBox::helpRequested, this, &QgsLabelSettingsDialog::showHelp );
959  vLayout->addWidget( mButtonBox );
960  setLayout( vLayout );
961  setWindowTitle( tr( "Label Settings" ) );
962 }
963 
964 QDialogButtonBox *QgsLabelSettingsDialog::buttonBox() const
965 {
966  return mButtonBox;
967 }
968 
969 void QgsLabelSettingsDialog::showHelp()
970 {
971  QgsHelp::openHelp( QStringLiteral( "style_library/label_settings.html" ) );
972 }
973 
974 
975 
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:369
QgsPalLayerSettings::useSubstitutions
bool useSubstitutions
True if substitutions should be applied.
Definition: qgspallabeling.h:552
QgsPalLayerSettings::preserveRotation
bool preserveRotation
True if label rotation should be preserved during label pin/unpin operations.
Definition: qgspallabeling.h:805
QgsStyle::saveTextFormat
bool saveTextFormat(const QString &name, const QgsTextFormat &format, bool favorite, const QStringList &tags)
Adds a text format to the database.
Definition: qgsstyle.cpp:820
qgsexpressioncontextutils.h
QgsPalLayerSettings::scaleVisibility
bool scaleVisibility
Set to true to limit label visibility to a range of scales.
Definition: qgspallabeling.h:832
QgsPalLayerSettings::distUnits
QgsUnitTypes::RenderUnit distUnits
Units the distance from feature to the label.
Definition: qgspallabeling.h:707
QgsCalloutWidget
Definition: qgscalloutwidget.h:34
QgsPalLayerSettings::DirectionSymbols
DirectionSymbols
Definition: qgspallabeling.h:302
QgsPalLayerSettings::PerimeterCurved
@ PerimeterCurved
Arranges candidates following the curvature of a polygon's boundary. Applies to polygon layers only.
Definition: qgspallabeling.h:229
QgsCalloutMetadata
Definition: qgscalloutsregistry.h:110
QgsPalLayerSettings::leftDirectionSymbol
QString leftDirectionSymbol
String to use for left direction arrows.
Definition: qgspallabeling.h:603
QgsStyle::ColorrampEntity
@ ColorrampEntity
Color ramps.
Definition: qgsstyle.h:182
QgsPalLayerSettings::angleOffset
double angleOffset
Label rotation, in degrees clockwise.
Definition: qgspallabeling.h:802
QgsPalLayerSettings::decimals
int decimals
Number of decimal places to show for numeric labels.
Definition: qgspallabeling.h:634
QgsPalLayerSettings::AroundPoint
@ AroundPoint
Arranges candidates in a circle around a point (or centroid of a polygon). Applies to point or polygo...
Definition: qgspallabeling.h:222
QgsPalLayerSettings::reverseDirectionSymbol
bool reverseDirectionSymbol
True if direction symbols should be reversed.
Definition: qgspallabeling.h:619
QgsPalLayerSettings::overrunDistance
double overrunDistance
Distance which labels are allowed to overrun past the start or end of line features.
Definition: qgspallabeling.h:746
QgsLabelObstacleSettingsWidget::setSettings
void setSettings(const QgsLabelObstacleSettings &settings)
Sets the obstacle settings to show in the widget.
Definition: qgslabelobstaclesettingswidget.cpp:45
QgsExpressionContext::EXPR_ORIGINAL_VALUE
static const QString EXPR_ORIGINAL_VALUE
Inbuilt variable name for value original value variable.
Definition: qgsexpressioncontext.h:721
QgsExpressionContextUtils::globalScope
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
Definition: qgsexpressioncontextutils.cpp:33
QgsReadWriteContext
Definition: qgsreadwritecontext.h:34
QgsPalLayerSettings::maxCurvedCharAngleOut
double maxCurvedCharAngleOut
Maximum angle between outside curved label characters (valid range -20.0 to -95.0)
Definition: qgspallabeling.h:817
qgsmapcanvas.h
QgsWkbTypes::NullGeometry
@ NullGeometry
Definition: qgswkbtypes.h:145
QgsMapLayerType::VectorLayer
@ VectorLayer
QgsCallout
Abstract base class for callout renderers.
Definition: qgscallout.h:46
QgsPalLayerSettings::setPolygonPlacementFlags
void setPolygonPlacementFlags(QgsLabeling::PolygonPlacementFlags flags)
Sets the polygon placement flags, which dictate how polygon labels can be placed.
Definition: qgspallabeling.h:667
QgsLabelSettingsWidgetBase::dataDefinedProperties
QgsPropertyCollection dataDefinedProperties() const
Returns the current data defined properties state as specified in the widget.
Definition: qgslabelsettingswidgetbase.cpp:123
QgsPalLayerSettings
Definition: qgspallabeling.h:205
QgsPanelWidget::findParentPanel
static QgsPanelWidget * findParentPanel(QWidget *widget)
Traces through the parents of a widget to find if it is contained within a QgsPanelWidget widget.
Definition: qgspanelwidget.cpp:49
qgslabelobstaclesettingswidget.h
QgsPalLayerSettings::zIndex
double zIndex
Z-Index of label, where labels with a higher z-index are rendered on top of labels with a lower z-ind...
Definition: qgspallabeling.h:925
QgsPalLayerSettings::labelPerPart
bool labelPerPart
true if every part of a multi-part feature should be labeled.
Definition: qgspallabeling.h:889
QgsStyle::labelSettingsNames
QStringList labelSettingsNames() const
Returns a list of names of label settings in the style.
Definition: qgsstyle.cpp:1951
QgsLabelThinningSettings::setMinimumFeatureSize
void setMinimumFeatureSize(double size)
Sets the minimum feature size (in millimeters) for a feature to be labelled.
Definition: qgslabelthinningsettings.h:78
QgsPalLayerSettings::upsidedownLabels
UpsideDownLabels upsidedownLabels
Controls whether upside down labels are displayed and how they are handled.
Definition: qgspallabeling.h:883
QgsLabelThinningSettings::setMaximumNumberLabels
void setMaximumNumberLabels(int number)
Sets the maximum number of labels which should be drawn for this layer.
Definition: qgslabelthinningsettings.h:66
QgsExpressionContext::setOriginalValueVariable
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
Definition: qgsexpressioncontext.cpp:566
QgsPalLayerSettings::fontMaxPixelSize
int fontMaxPixelSize
Maximum pixel size for showing rendered map unit labels (1 - 10000).
Definition: qgspallabeling.h:877
QgsExpressionContextUtils::layerScope
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
Definition: qgsexpressioncontextutils.cpp:264
QgsSymbolWidgetContext
Definition: qgssymbolwidgetcontext.h:35
QgsMapCanvas
Definition: qgsmapcanvas.h:83
QgsPalLayerSettings::thinningSettings
const QgsLabelThinningSettings & thinningSettings() const
Returns the label thinning settings.
Definition: qgspallabeling.h:1073
QgsPanelWidget::openPanel
void openPanel(QgsPanelWidget *panel)
Open a panel or dialog depending on dock mode setting If dock mode is true this method will emit the ...
Definition: qgspanelwidget.cpp:79
QgsPalLayerSettings::BelowLine
@ BelowLine
Labels can be placed below a line feature.
Definition: qgspallabeling.h:274
QgsPalLayerSettings::yOffset
double yOffset
Vertical offset of label.
Definition: qgspallabeling.h:783
QgsProject::transformContext
QgsCoordinateTransformContext transformContext
Definition: qgsproject.h:99
QgsPalLayerSettings::OffsetType
OffsetType
Behavior modifier for label offset and distance, only applies in some label placement modes.
Definition: qgspallabeling.h:257
QgsPalLayerSettings::addDirectionSymbol
bool addDirectionSymbol
If true, '<' or '>' (or custom strings set via leftDirectionSymbol and rightDirectionSymbol) will be ...
Definition: qgspallabeling.h:596
QgsExpressionContextUtils::mapSettingsScope
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object.
Definition: qgsexpressioncontextutils.cpp:356
QgsPalLayerSettings::QuadrantPosition
QuadrantPosition
Definition: qgspallabeling.h:282
QgsPalLayerSettings::mergeLines
bool mergeLines
true if connected line features with identical label text should be merged prior to generating label ...
Definition: qgspallabeling.h:895
QgsProject::instance
static QgsProject * instance()
Returns the QgsProject singleton instance.
Definition: qgsproject.cpp:458
QgsPalLayerSettings::geometryGeneratorType
QgsWkbTypes::GeometryType geometryGeneratorType
The type of the result geometry of the geometry generator.
Definition: qgspallabeling.h:931
QgsPalLayerSettings::overrunDistanceMapUnitScale
QgsMapUnitScale overrunDistanceMapUnitScale
Map unit scale for label overrun distance.
Definition: qgspallabeling.h:762
QgsPalLayerSettings::MultiLineAlign
MultiLineAlign
Definition: qgspallabeling.h:309
QgsPalLayerSettings::minimumScale
double minimumScale
The minimum map scale (i.e.
Definition: qgspallabeling.h:856
QgsPalLayerSettings::substitutions
QgsStringReplacementCollection substitutions
Substitution collection for automatic text substitution with labels.
Definition: qgspallabeling.h:550
QgsStyle::LegendPatchShapeEntity
@ LegendPatchShapeEntity
Legend patch shape (since QGIS 3.14)
Definition: qgsstyle.h:186
QgsDebugMsg
#define QgsDebugMsg(str)
Definition: qgslogger.h:38
QgsLabelObstacleSettingsWidget::updateDataDefinedProperties
void updateDataDefinedProperties(QgsPropertyCollection &properties) override
Updates a data defined properties collection, correctly setting the values for any properties related...
Definition: qgslabelobstaclesettingswidget.cpp:67
QgsPalLayerSettings::Line
@ Line
Arranges candidates parallel to a generalised line representing the feature or parallel to a polygon'...
Definition: qgspallabeling.h:224
QgsPalLayerSettings::OnLine
@ OnLine
Labels can be placed directly over a line feature.
Definition: qgspallabeling.h:270
QgsPalLayerSettings::maximumScale
double maximumScale
The maximum map scale (i.e.
Definition: qgspallabeling.h:844
QgsCallout::type
virtual QString type() const =0
Returns a unique string representing the callout type.
QgsExpressionContext::EXPR_SYMBOL_COLOR
static const QString EXPR_SYMBOL_COLOR
Inbuilt variable name for symbol color variable.
Definition: qgsexpressioncontext.h:723
QgsPanelWidget::dockMode
bool dockMode()
Returns the dock mode state.
Definition: qgspanelwidget.h:83
QgsPalLayerSettings::dist
double dist
Distance from feature to the label.
Definition: qgspallabeling.h:700
qgsstylesavedialog.h
QgsPalLayerSettings::OverPoint
@ OverPoint
Arranges candidates over a point (or centroid of a polygon), or at a preset offset from the point....
Definition: qgspallabeling.h:223
QgsWkbTypes::PolygonGeometry
@ PolygonGeometry
Definition: qgswkbtypes.h:143
QgsStyle::SymbolEntity
@ SymbolEntity
Symbols.
Definition: qgsstyle.h:180
QgsStyle::TagEntity
@ TagEntity
Tags.
Definition: qgsstyle.h:181
QgsPropertyOverrideButton
Definition: qgspropertyoverridebutton.h:50
QgsSymbolWidgetContext::setMapCanvas
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
Definition: qgssymbolwidgetcontext.cpp:49
QgsStyle::LabelSettingsEntity
@ LabelSettingsEntity
Label settings.
Definition: qgsstyle.h:185
QgsStyle::defaultStyle
static QgsStyle * defaultStyle()
Returns default application-wide style.
Definition: qgsstyle.cpp:111
qgsauxiliarystorage.h
QgsCalloutRegistry
Definition: qgscalloutsregistry.h:155
qgsapplication.h
qgsnewauxiliarylayerdialog.h
QgsPalLayerSettings::repeatDistance
double repeatDistance
Distance for repeating labels for a single feature.
Definition: qgspallabeling.h:724
QgsPalLayerSettings::formatNumbers
bool formatNumbers
Set to true to format numeric label text as numbers (e.g.
Definition: qgspallabeling.h:627
QgsPalLayerSettings::repeatDistanceUnit
QgsUnitTypes::RenderUnit repeatDistanceUnit
Units for repeating labels for a single feature.
Definition: qgspallabeling.h:731
QgsPalLayerSettings::xOffset
double xOffset
Horizontal offset of label.
Definition: qgspallabeling.h:775
QgsPalLayerSettings::displayAll
bool displayAll
If true, all features will be labelled even when overlaps occur.
Definition: qgspallabeling.h:880
QgsPalLayerSettings::OrderedPositionsAroundPoint
@ OrderedPositionsAroundPoint
Candidates are placed in predefined positions around a point. Preference is given to positions with g...
Definition: qgspallabeling.h:228
QgsTextFormat
Definition: qgstextformat.h:38
QgsDistanceArea::setEllipsoid
bool setEllipsoid(const QString &ellipsoid)
Sets the ellipsoid by its acronym.
Definition: qgsdistancearea.cpp:66
QgsFeatureRequest
Definition: qgsfeaturerequest.h:75
QgsExpressionContextUtils::projectScope
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
Definition: qgsexpressioncontextutils.cpp:221
QgsCalloutAbstractMetadata
Definition: qgscalloutsregistry.h:39
QgsPalLayerSettings::fontLimitPixelSize
bool fontLimitPixelSize
true if label sizes should be limited by pixel size.
Definition: qgspallabeling.h:863
QgsPalLayerSettings::Curved
@ Curved
Arranges candidates following the curvature of a line feature. Applies to line layers only.
Definition: qgspallabeling.h:225
QgsCalloutRegistry::calloutTypes
QStringList calloutTypes() const
Returns a list of all available callout types.
Definition: qgscalloutsregistry.cpp:76
QgsWkbTypes::geometryDisplayString
static QString geometryDisplayString(GeometryType type)
Returns a display string for a geometry type.
Definition: qgswkbtypes.cpp:155
QgsPalLayerSettings::MapOrientation
@ MapOrientation
Signifies that the AboveLine and BelowLine flags should respect the map's orientation rather than the...
Definition: qgspallabeling.h:277
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:29
QgsLabelSettingsWidgetBase::setContext
virtual void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression ...
Definition: qgslabelsettingswidgetbase.cpp:32
QgsPalLayerSettings::setDataDefinedProperties
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the label's property collection, used for data defined overrides.
Definition: qgspallabeling.h:1008
whileBlocking
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Definition: qgis.h:262
QgsPalLayerSettings::plusSign
bool plusSign
Whether '+' signs should be prepended to positive numeric labels.
Definition: qgspallabeling.h:641
QgsPalLayerSettings::wrapChar
QString wrapChar
Wrapping character string.
Definition: qgspallabeling.h:560
QgsPalLayerSettings::placementFlags
unsigned int placementFlags
Definition: qgspallabeling.h:648
qgscalloutsregistry.h
QgsCalloutWidget::callout
virtual QgsCallout * callout()=0
Returns the callout defined by the current settings in the widget.
QgsPalLayerSettings::autoWrapLength
int autoWrapLength
If non-zero, indicates that label text should be automatically wrapped to (ideally) the specified num...
Definition: qgspallabeling.h:569
QgsPalLayerSettings::multilineAlign
MultiLineAlign multilineAlign
Horizontal alignment of multi-line labels.
Definition: qgspallabeling.h:584
QgsLabelSettingsWidgetDialog
Definition: qgslabelsettingswidgetbase.h:142
QgsExpressionBuilderDialog
Definition: qgsexpressionbuilderdialog.h:30
QgsPalLayerSettings::overrunDistanceUnit
QgsUnitTypes::RenderUnit overrunDistanceUnit
Units for label overrun distance.
Definition: qgspallabeling.h:754
QgsPalLayerSettings::drawLabels
bool drawLabels
Whether to draw labels for this layer.
Definition: qgspallabeling.h:522
QgsPalLayerSettings::offsetType
OffsetType offsetType
Offset type for layer (only applies in certain placement modes)
Definition: qgspallabeling.h:717
QgsPalLayerSettings::setFormat
void setFormat(const QgsTextFormat &format)
Sets the label text formatting settings, e.g., font settings, buffer settings, etc.
Definition: qgspallabeling.h:1023
QgsPalLayerSettings::placement
Placement placement
Definition: qgspallabeling.h:645
QgsPalLayerSettings::repeatDistanceMapUnitScale
QgsMapUnitScale repeatDistanceMapUnitScale
Map unit scale for repeating labels for a single feature.
Definition: qgspallabeling.h:738
QgsStyle::SmartgroupEntity
@ SmartgroupEntity
Smart groups.
Definition: qgsstyle.h:183
QgsPalLayerSettings::fitInPolygonOnly
bool fitInPolygonOnly
true if only labels which completely fit within a polygon are allowed.
Definition: qgspallabeling.h:693
QgsTextFormatWidget::setFormatFromStyle
virtual void setFormatFromStyle(const QString &name, QgsStyle::StyleEntity type)
Sets the current text settings from a style entry.
Definition: qgstextformatwidget.cpp:1768
QgsGeometry::isNull
bool isNull
Definition: qgsgeometry.h:125
QgsPalLayerSettings::UpsideDownLabels
UpsideDownLabels
Definition: qgspallabeling.h:295
QgsTextFormatWidget
Definition: qgstextformatwidget.h:50
QgsDistanceArea::setSourceCrs
void setSourceCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets source spatial reference system crs.
Definition: qgsdistancearea.cpp:60
QgsCalloutRegistry::createCallout
QgsCallout * createCallout(const QString &type, const QVariantMap &properties=QVariantMap(), const QgsReadWriteContext &context=QgsReadWriteContext()) const
Creates a new instance of a callout, given the callout type and properties.
Definition: qgscalloutsregistry.cpp:91
QgsPalLayerSettings::setCallout
void setCallout(QgsCallout *callout)
Sets the label callout renderer, responsible for drawing label callouts.
Definition: qgspallabeling.cpp:1253
QgsCallout::setEnabled
void setEnabled(bool enabled)
Sets whether the callout is enabled.
Definition: qgscallout.cpp:145
QgsStyle::removeLabelSettings
bool removeLabelSettings(const QString &name)
Removes label settings from the style.
Definition: qgsstyle.cpp:928
QgsLabelSettingsWidgetBase::setDataDefinedProperties
void setDataDefinedProperties(const QgsPropertyCollection &dataDefinedProperties)
Sets the current data defined properties to show in the widget.
Definition: qgslabelsettingswidgetbase.cpp:128
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext....
Definition: qgsexpressioncontext.h:111
QgsPalLayerSettings::Horizontal
@ Horizontal
Arranges horizontal candidates scattered throughout a polygon feature. Applies to polygon layers only...
Definition: qgspallabeling.h:226
QgsPalLayerSettings::MultiLeft
@ MultiLeft
Definition: qgspallabeling.h:311
QgsTextFormatWidget::setContext
virtual void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the widget is shown, e.g., the associated map canvas and expression context...
Definition: qgstextformatwidget.cpp:1157
QgsPalLayerSettings::placeDirectionSymbol
DirectionSymbols placeDirectionSymbol
Placement option for direction symbols.
Definition: qgspallabeling.h:616
QgsLabelObstacleSettingsWidget::setGeometryType
void setGeometryType(QgsWkbTypes::GeometryType type) override
Sets the geometry type of the features to customize the widget accordingly.
Definition: qgslabelobstaclesettingswidget.cpp:61
qgsvectorlayer.h
QgsCalloutRegistry::calloutMetadata
QgsCalloutAbstractMetadata * calloutMetadata(const QString &type) const
Returns the metadata for specified the specified callout type.
Definition: qgscalloutsregistry.cpp:81
QgsCallout::properties
virtual QVariantMap properties(const QgsReadWriteContext &context) const
Returns the properties describing the callout encoded in a string format.
Definition: qgscallout.cpp:57
QgsPropertyCollection
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
Definition: qgspropertycollection.h:318
QgsPalLayerSettings::AboveLine
@ AboveLine
Labels can be placed above a line feature.
Definition: qgspallabeling.h:271
QgsPalLayerSettings::priority
int priority
Label priority.
Definition: qgspallabeling.h:823
QgsPropertyOverrideButton::isActive
bool isActive() const
Returns true if the button has an active property.
Definition: qgspropertyoverridebutton.h:128
QgsWkbTypes::LineGeometry
@ LineGeometry
Definition: qgswkbtypes.h:142
QgsWkbTypes::PointGeometry
@ PointGeometry
Definition: qgswkbtypes.h:141
qgscallout.h
QgsPalLayerSettings::fieldName
QString fieldName
Name of field (or an expression) to use for label text.
Definition: qgspallabeling.h:531
QgsStyle::textFormatNames
QStringList textFormatNames() const
Returns a list of names of text formats in the style.
Definition: qgsstyle.cpp:1905
qgscalloutwidget.h
QgsExpressionContextUtils::updateSymbolScope
static QgsExpressionContextScope * updateSymbolScope(const QgsSymbol *symbol, QgsExpressionContextScope *symbolScope=nullptr)
Updates a symbol scope related to a QgsSymbol to an expression context.
Definition: qgsexpressioncontextutils.cpp:458
QgsPalLayerSettings::rightDirectionSymbol
QString rightDirectionSymbol
String to use for right direction arrows.
Definition: qgspallabeling.h:610
QgsWkbTypes::GeometryType
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:139
QgsGeometry
Definition: qgsgeometry.h:122
QgsStyle
Definition: qgsstyle.h:159
QgsStyle::TextFormatEntity
@ TextFormatEntity
Text formats.
Definition: qgsstyle.h:184
QgsHelp::openHelp
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
Definition: qgshelp.cpp:36
QgsPalLayerSettings::geometryGenerator
QString geometryGenerator
The geometry generator expression. Null if disabled.
Definition: qgspallabeling.h:928
QgsVectorLayer
Definition: qgsvectorlayer.h:385
QgsCalloutMetadata::setWidgetFunction
void setWidgetFunction(QgsCalloutWidgetFunc f)
Definition: qgscalloutsregistry.h:130
QgsMapLayer
Definition: qgsmaplayer.h:81
QgsPalLayerSettings::OutsidePolygons
@ OutsidePolygons
Candidates are placed outside of polygon boundaries. Applies to polygon layers only....
Definition: qgspallabeling.h:230
QgsPalLayerSettings::quadOffset
QuadrantPosition quadOffset
Sets the quadrant in which to offset labels from feature.
Definition: qgspallabeling.h:767
QgsPalLayerSettings::MultiFollowPlacement
@ MultiFollowPlacement
Definition: qgspallabeling.h:314
QgsPalLayerSettings::maxCurvedCharAngleIn
double maxCurvedCharAngleIn
Maximum angle between inside curved label characters (valid range 20.0 to 60.0).
Definition: qgspallabeling.h:811
QgsCalloutAbstractMetadata::createCallout
virtual QgsCallout * createCallout(const QVariantMap &properties, const QgsReadWriteContext &context)=0
Create a callout of this type given the map of properties.
QgsWkbTypes::UnknownGeometry
@ UnknownGeometry
Definition: qgswkbtypes.h:144
QgsPalLayerSettings::isExpression
bool isExpression
true if this label is made from a expression string, e.g., FieldName || 'mm'
Definition: qgspallabeling.h:537
QgsPalLayerSettings::useMaxLineLengthForAutoWrap
bool useMaxLineLengthForAutoWrap
If true, indicates that when auto wrapping label text the autoWrapLength length indicates the maximum...
Definition: qgspallabeling.h:581
QgsApplication::calloutRegistry
static QgsCalloutRegistry * calloutRegistry()
Returns the application's callout registry, used for managing callout types.
Definition: qgsapplication.cpp:2154
QgsPalLayerSettings::geometryGeneratorEnabled
bool geometryGeneratorEnabled
Defines if the geometry generator is enabled or not. If disabled, the standard geometry will be taken...
Definition: qgspallabeling.h:934
QgsExpressionContextUtils::atlasScope
static QgsExpressionContextScope * atlasScope(const QgsLayoutAtlas *atlas)
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
Definition: qgsexpressioncontextutils.cpp:570
QgsPalLayerSettings::labelOffsetMapUnitScale
QgsMapUnitScale labelOffsetMapUnitScale
Map unit scale for label offset.
Definition: qgspallabeling.h:799
QgsPalLayerSettings::offsetUnits
QgsUnitTypes::RenderUnit offsetUnits
Units for offsets of label.
Definition: qgspallabeling.h:791
QgsExpressionContext::setHighlightedVariables
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user.
Definition: qgsexpressioncontext.cpp:324
QgsStyle::addLabelSettings
bool addLabelSettings(const QString &name, const QgsPalLayerSettings &settings, bool update=false)
Adds label settings with the specified name to the style.
Definition: qgsstyle.cpp:315
QgsLabelObstacleSettingsWidget
Definition: qgslabelobstaclesettingswidget.h:31
QgsDistanceArea
Definition: qgsdistancearea.h:49
QgsPalLayerSettings::MultiRight
@ MultiRight
Definition: qgspallabeling.h:313
QgsFeature
Definition: qgsfeature.h:55
qgsvectorlayerlabeling.h
QgsLabelThinningSettings::setLimitNumberLabelsEnabled
void setLimitNumberLabelsEnabled(bool enabled)
Sets whether the the number of labels drawn for the layer should be limited.
Definition: qgslabelthinningsettings.h:50
QgsLabelObstacleSettingsWidget::settings
QgsLabelObstacleSettings settings() const
Returns the obstacle settings defined by the widget.
Definition: qgslabelobstaclesettingswidget.cpp:53
QgsSymbolWidgetContext::setExpressionContext
void setExpressionContext(QgsExpressionContext *context)
Sets the optional expression context used for the widget.
Definition: qgssymbolwidgetcontext.cpp:69
QgsLabelSettingsWidgetBase::changed
void changed()
Emitted when any of the settings described by the widget are changed.
QgsExpression
Definition: qgsexpression.h:113
QgsPalLayerSettings::fontMinPixelSize
int fontMinPixelSize
Minimum pixel size for showing rendered map unit labels (1 - 1000).
Definition: qgspallabeling.h:870
QgsCalloutWidget::changed
void changed()
Should be emitted whenever configuration changes happened on this symbol layer configuration.
QgsStyle::removeTextFormat
bool removeTextFormat(const QString &name)
Removes a text format from the style.
Definition: qgsstyle.cpp:854
QgsStyle::addTextFormat
bool addTextFormat(const QString &name, const QgsTextFormat &format, bool update=false)
Adds a text format with the specified name to the style.
Definition: qgsstyle.cpp:294
QgsGeometry::type
QgsWkbTypes::GeometryType type
Definition: qgsgeometry.h:126
QgsPalLayerSettings::Free
@ Free
Arranges candidates scattered throughout a polygon feature. Candidates are rotated to respect the pol...
Definition: qgspallabeling.h:227
QgsStyle::labelSettings
QgsPalLayerSettings labelSettings(const QString &name) const
Returns the label settings with the specified name.
Definition: qgsstyle.cpp:1915
QgsMapLayer::type
QgsMapLayerType type() const
Returns the type of the layer.
Definition: qgsmaplayer.cpp:129
qgshelp.h
QgsPalLayerSettings::layerType
QgsWkbTypes::GeometryType layerType
Geometry type of layers associated with these settings.
Definition: qgspallabeling.h:940
QgsCalloutWidgetFunc
QgsCalloutWidget *(* QgsCalloutWidgetFunc)(QgsVectorLayer *)
Definition: qgscalloutsregistry.h:103
QgsStyle::saveLabelSettings
bool saveLabelSettings(const QString &name, const QgsPalLayerSettings &settings, bool favorite, const QStringList &tags)
Adds label settings to the database.
Definition: qgsstyle.cpp:894
qgsproject.h
qgslabelinggui.h
QgsPalLayerSettings::setObstacleSettings
void setObstacleSettings(const QgsLabelObstacleSettings &settings)
Sets the label obstacle settings.
Definition: qgspallabeling.h:1065
QgsPalLayerSettings::centroidInside
bool centroidInside
true if centroid positioned labels must be placed inside their corresponding feature polygon,...
Definition: qgspallabeling.h:680
QgsPalLayerSettings::MultiCenter
@ MultiCenter
Definition: qgspallabeling.h:312
QgsPalLayerSettings::centroidWhole
bool centroidWhole
true if feature centroid should be calculated from the whole feature, or false if only the visible pa...
Definition: qgspallabeling.h:673
QgsPalLayerSettings::distMapUnitScale
QgsMapUnitScale distMapUnitScale
Map unit scale for label feature distance.
Definition: qgspallabeling.h:714
QgsStyle::StyleEntity
StyleEntity
Enum for Entities involved in a style.
Definition: qgsstyle.h:178
QgsExpressionContext::setFeature
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
Definition: qgsexpressioncontext.cpp:521
qgsexpressionbuilderdialog.h