QGIS API Documentation 3.99.0-Master (7d2ca374f2d)
Loading...
Searching...
No Matches
qgslabelingwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslabelingwidget.h
3 ---------------------
4 begin : September 2015
5 copyright : (C) 2015 by Martin Dobias
6 email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15#ifndef QGSLABELINGWIDGET_H
16#define QGSLABELINGWIDGET_H
17
18// We don't want to expose this in the public API
19
20#include "ui_qgslabelingwidget.h"
21
22#include "qgis_gui.h"
24#include "qgspallabeling.h"
26
27#include <QWidget>
28
29#define SIP_NO_FILE
30
31class QgsLabelingGui;
32class QgsMapCanvas;
34class QgsVectorLayer;
35class QgsMapLayer;
36class QgsMessageBar;
37
45class GUI_EXPORT QgsLabelingWidget : public QgsMapLayerConfigWidget, private Ui::QgsLabelingWidget
46{
47 Q_OBJECT
48 public:
50 QgsLabelingWidget( QgsVectorLayer *layer, QgsMapCanvas *canvas, QWidget *parent = nullptr, QgsMessageBar *messageBar = nullptr );
51
56 QgsLabelingGui *labelingGui();
57
65 static void showLabelingEngineRules( QWidget *parent, QgsMapCanvas *canvas );
66
74 static void showEngineConfiguration( QWidget *parent, QgsMapCanvas *canvas );
75
76 public slots:
78 void setLayer( QgsMapLayer *layer );
81
83 void apply() override;
84
86 void adaptToLayer();
87
89 void resetSettings();
90
91 signals:
94
95 private slots:
96 void labelModeChanged( int index );
97 void showLabelingEngineRulesPrivate();
98 void showEngineConfigDialogPrivate();
99
100 private:
101 enum Mode
102 {
103 ModeNone,
104 ModeSingle,
105 ModeRuleBased,
106 ModeBlocking
107 };
108
109 QgsVectorLayer *mLayer = nullptr;
110 QgsMapCanvas *mCanvas = nullptr;
111 QgsMessageBar *mMessageBar = nullptr;
112
113 QWidget *mWidget = nullptr;
114 std::unique_ptr<QgsPalLayerSettings> mSimpleSettings;
115 std::unique_ptr<QgsAbstractVectorLayerLabeling> mOldSettings;
116 bool mOldLabelsEnabled = false;
117};
118
119#endif // QGSLABELINGWIDGET_H
void adaptToLayer()
reload the settings shown in the dialog from the current layer
QgsLabelingGui * labelingGui()
Returns the labeling gui widget or nullptr if none.
static void showLabelingEngineRules(QWidget *parent, QgsMapCanvas *canvas)
Shows the labeling engine rules.
QgsLabelingWidget(QgsVectorLayer *layer, QgsMapCanvas *canvas, QWidget *parent=nullptr, QgsMessageBar *messageBar=nullptr)
constructor
void auxiliaryFieldCreated()
Emitted when an auxiliary field is created.
void writeSettingsToLayer()
save config to layer
void resetSettings()
Reset the settings.
void setLayer(QgsMapLayer *layer)
Sets the layer to configure.
static void showEngineConfiguration(QWidget *parent, QgsMapCanvas *canvas)
Shows the labeling engine configuration.
Map canvas is a class for displaying all GIS data types on a canvas.
QgsMapLayerConfigWidget(QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent=nullptr)
A panel widget that can be shown in the map style dock.
virtual void apply()=0
Called when changes to the layer need to be made.
Base class for all map layer types.
Definition qgsmaplayer.h:83
A bar for displaying non-blocking messages to the user.
Widget for configuring rule based labeling.
Represents a vector layer which manages a vector based dataset.