16#include <QDialogButtonBox>
32 , mMessageBar( messageBar )
38 mLabelModeComboBox->addItem(
QgsApplication::getThemeIcon( QStringLiteral(
"labelingSingle.svg" ) ), tr(
"Labels on Vertices" ), ModeVertices );
39 mLabelModeComboBox->addItem(
QgsApplication::getThemeIcon( QStringLiteral(
"labelingSingle.svg" ) ), tr(
"Labels on Faces" ), ModeFaces );
41 connect( mLabelModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsMeshLabelingWidget::labelModeChanged );
55 return qobject_cast<QgsLabelingGui *>( mWidget );
80 QgsMeshLayer *layer = qobject_cast<QgsMeshLayer *>( mapLayer );
103 Mode mode = ModeNone;
108 mode = labeling->provider( mLayer )->labelFaces() ? ModeFaces : ModeVertices;
111 mLabelModeComboBox->setCurrentIndex( mLabelModeComboBox->findData( mode ) );
113 if ( QgsLabelingGui *lg = qobject_cast<QgsLabelingGui *>( mWidget ) )
121 const Mode mode =
static_cast< Mode
>( mLabelModeComboBox->currentData().toInt() );
154void QgsMeshLabelingWidget::labelModeChanged(
int index )
157 mStackedWidget->removeWidget( mWidget );
165 const Mode mode =
static_cast< Mode
>( mLabelModeComboBox->currentData().toInt() );
187 QgsLabelingGui *
labelingGui =
new QgsLabelingGui( mLayer, mCanvas, *mSettings,
this, geomType );
188 labelingGui->setLabelMode( QgsLabelingGui::Labels );
189 labelingGui->layout()->setContentsMargins( 0, 0, 0, 0 );
199 mStackedWidget->addWidget( mWidget );
200 mStackedWidget->setCurrentWidget( mWidget );
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
@ Mesh
Mesh layer. Added in QGIS 3.2.
static QgsPalLayerSettings defaultSettingsForLayer(const QgsMeshLayer *layer)
Returns the default layer settings to use for the specified mesh layer.
virtual QgsAbstractMeshLayerLabeling * 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.
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.
Basic implementation of the labeling interface for mesh layer.
QgsPalLayerSettings settings(const QString &providerId=QString()) const override
Gets associated label settings.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
const QgsAbstractMeshLayerLabeling * labeling() const
Access to const labeling configuration.
void setLabeling(QgsAbstractMeshLayerLabeling *labeling)
Sets labeling configuration.
void setLabelsEnabled(bool enabled)
Sets whether labels should be enabled for the layer.
bool labelsEnabled() const
Returns whether the layer contains labels which are enabled and should be drawn.
A bar for displaying non-blocking messages to the user.
Contains settings for how a map layer will be labeled.
static QgsProject * instance()
Returns the QgsProject singleton instance.
void setDirty(bool b=true)
Flag the project as dirty (modified).
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.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.