16#include <QDialogButtonBox> 
   34  , mMessageBar( messageBar )
 
   40  mLabelModeComboBox->addItem( 
QgsApplication::getThemeIcon( QStringLiteral( 
"labelingSingle.svg" ) ), tr( 
"Single Labels" ), ModeSingle );
 
   41  mLabelModeComboBox->addItem( 
QgsApplication::getThemeIcon( QStringLiteral( 
"labelingRuleBased.svg" ) ), tr( 
"Rule-based Labeling" ), ModeRuleBased );
 
   44  connect( mEngineSettingsButton, &QAbstractButton::clicked, 
this, &QgsLabelingWidget::showEngineConfigDialog );
 
   46  connect( mLabelModeComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsLabelingWidget::labelModeChanged );
 
   50  mEngineSettingsButton->setIconSize( QSize( iconSize16, iconSize16 ) );
 
 
   55  return qobject_cast<QgsLabelingGui *>( mWidget );
 
 
   81  QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( mapLayer );
 
 
  104    mLabelModeComboBox->setCurrentIndex( mLabelModeComboBox->findData( ModeRuleBased ) );
 
  110    mLabelModeComboBox->setCurrentIndex( mLabelModeComboBox->findData( lyr.
drawLabels ? ModeSingle : ModeBlocking ) );
 
  114    mLabelModeComboBox->setCurrentIndex( mLabelModeComboBox->findData( ModeNone ) );
 
  117  if ( QgsLabelingGui *lg = qobject_cast<QgsLabelingGui *>( mWidget ) )
 
 
  125  const Mode mode = 
static_cast< Mode 
>( mLabelModeComboBox->currentData().toInt() );
 
 
  167void QgsLabelingWidget::labelModeChanged( 
int index )
 
  170    mStackedWidget->removeWidget( mWidget );
 
  178  const Mode mode = 
static_cast< Mode 
>( mLabelModeComboBox->currentData().toInt() );
 
  189      mWidget = ruleWidget;
 
  190      mStackedWidget->addWidget( mWidget );
 
  191      mStackedWidget->setCurrentWidget( mWidget );
 
  198      mSimpleSettings.reset();
 
  211            if ( firstChild->settings() )
 
  217      if ( !mSimpleSettings )
 
  222      if ( mSimpleSettings->fieldName.isEmpty() )
 
  233          QgsLabelingGui *simpleWidget = 
new QgsLabelingGui( mLayer, mCanvas, *mSimpleSettings, 
this );
 
  234          simpleWidget->setContext( context );
 
  236          simpleWidget->setDockMode( 
dockMode() );
 
  240          simpleWidget->setLabelMode( QgsLabelingGui::Labels );
 
  242          mWidget = simpleWidget;
 
  251          obstacleWidget->
setSettings( mSimpleSettings->obstacleSettings() );
 
  254          mSimpleSettings->obstacleSettings().setIsObstacle( 
true );
 
  255          mSimpleSettings->drawLabels = 
false;
 
  259            mSimpleSettings->setObstacleSettings( obstacleWidget->
settings() );
 
  265          mWidget = obstacleWidget;
 
  274      mStackedWidget->addWidget( mWidget );
 
  275      mStackedWidget->setCurrentWidget( mWidget );
 
  285void QgsLabelingWidget::showEngineConfigDialog()
 
The Qgis class provides global constants for use throughout the application.
virtual QgsPalLayerSettings settings(const QString &providerId=QString()) const =0
Gets associated label settings.
static QgsPalLayerSettings defaultSettingsForLayer(const QgsVectorLayer *layer)
Returns the default layer settings to use for the specified vector layer.
virtual QString type() const =0
Unique type string of the labeling configuration implementation.
virtual QgsAbstractVectorLayerLabeling * clone() const =0
Returns a new copy of the object.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
Dialog for configuring the labeling engine.
Map canvas is a class for displaying all GIS data types on a canvas.
Base class for all map layer types.
void triggerRepaint(bool deferredUpdate=false)
Will advise the map canvas (and any other interested party) that this layer requires to be repainted.
A bar for displaying non-blocking messages to the user.
Contains settings for how a map layer will be labeled.
bool drawLabels
Whether to draw labels for this layer.
static QgsProject * instance()
Returns the QgsProject singleton instance.
void setDirty(bool b=true)
Flag the project as dirty (modified).
A child rule for QgsRuleBasedLabeling.
QgsRuleBasedLabeling::Rule * clone() const
clone this rule, return new instance
const QgsRuleBasedLabeling::RuleList & children() const
Returns all children rules of this rule.
Rule based labeling for a vector layer.
QgsRuleBasedLabeling::Rule * rootRule()
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
void setMessageBar(QgsMessageBar *bar)
Sets the message bar associated with the widget.
void widgetChanged()
Emitted when the text format defined by the widget changes.
Basic implementation of the labeling interface.
Represents a vector layer which manages a vector based data sets.
void setLabeling(QgsAbstractVectorLayerLabeling *labeling)
Sets labeling configuration.
bool labelsEnabled() const
Returns whether the layer contains labels which are enabled and should be drawn.
void setLabelsEnabled(bool enabled)
Sets whether labels should be enabled for the layer.
const QgsAbstractVectorLayerLabeling * labeling() const
Access to const labeling configuration.
Q_INVOKABLE Qgis::GeometryType geometryType() const
Returns point, line or polygon.
QString displayField() const
This is a shorthand for accessing the displayExpression if it is a simple field.
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly,...
@ Unknown
Unknown/invalid format.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.