16#include <QDialogButtonBox>
20#include "moc_qgsmeshlabelingwidget.cpp"
33 , mMessageBar( messageBar )
39 mLabelModeComboBox->addItem(
QgsApplication::getThemeIcon( QStringLiteral(
"labelingSingle.svg" ) ), tr(
"Labels on Vertices" ), ModeVertices );
40 mLabelModeComboBox->addItem(
QgsApplication::getThemeIcon( QStringLiteral(
"labelingSingle.svg" ) ), tr(
"Labels on Faces" ), ModeFaces );
42 connect( mLabelModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsMeshLabelingWidget::labelModeChanged );
56 return qobject_cast<QgsLabelingGui *>( mWidget );
81 QgsMeshLayer *layer = qobject_cast<QgsMeshLayer *>( mapLayer );
104 Mode mode = ModeNone;
109 mode = labeling->provider( mLayer )->labelFaces() ? ModeFaces : ModeVertices;
112 mLabelModeComboBox->setCurrentIndex( mLabelModeComboBox->findData( mode ) );
114 if ( QgsLabelingGui *lg = qobject_cast<QgsLabelingGui *>( mWidget ) )
122 const Mode mode =
static_cast< Mode
>( mLabelModeComboBox->currentData().toInt() );
155void QgsMeshLabelingWidget::labelModeChanged(
int index )
158 mStackedWidget->removeWidget( mWidget );
166 const Mode mode =
static_cast< Mode
>( mLabelModeComboBox->currentData().toInt() );
188 QgsLabelingGui *
labelingGui =
new QgsLabelingGui( mLayer, mCanvas, *mSettings,
this, geomType );
189 labelingGui->setLabelMode( QgsLabelingGui::Labels );
190 labelingGui->layout()->setContentsMargins( 0, 0, 0, 0 );
200 mStackedWidget->addWidget( mWidget );
201 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.