QGIS API Documentation  3.24.2-Tisler (13c1a02865)
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 #define SIP_NO_FILE
20 
21 #include <QWidget>
22 
23 #include "ui_qgslabelingwidget.h"
24 #include "qgspallabeling.h"
25 #include "qgsvectorlayerlabeling.h"
26 #include "qgis_gui.h"
27 
29 
30 class QgsLabelingGui;
31 class QgsMapCanvas;
33 class QgsVectorLayer;
34 class QgsMapLayer;
35 class QgsMessageBar;
36 
44 class GUI_EXPORT QgsLabelingWidget : public QgsMapLayerConfigWidget, private Ui::QgsLabelingWidget
45 {
46  Q_OBJECT
47  public:
49  QgsLabelingWidget( QgsVectorLayer *layer, QgsMapCanvas *canvas, QWidget *parent = nullptr, QgsMessageBar *messageBar = nullptr );
50 
56  QgsLabelingGui *labelingGui();
57 
58  public slots:
60  void setLayer( QgsMapLayer *layer );
62  void writeSettingsToLayer();
63 
65  void apply() override;
66 
68  void adaptToLayer();
69 
71  void resetSettings();
72 
73  signals:
76 
77  private slots:
78  void labelModeChanged( int index );
79  void showEngineConfigDialog();
80 
81  private:
82 
83  enum Mode
84  {
85  ModeNone,
86  ModeSingle,
87  ModeRuleBased,
88  ModeBlocking
89  };
90 
91  QgsVectorLayer *mLayer = nullptr;
92  QgsMapCanvas *mCanvas = nullptr;
93  QgsMessageBar *mMessageBar = nullptr;
94 
95  QWidget *mWidget = nullptr;
96  std::unique_ptr< QgsPalLayerSettings > mSimpleSettings;
97  std::unique_ptr< QgsAbstractVectorLayerLabeling > mOldSettings;
98  bool mOldLabelsEnabled = false;
99 };
100 
101 #endif // QGSLABELINGWIDGET_H
Master widget for configuration of labeling of a vector layer.
void auxiliaryFieldCreated()
Emitted when an auxiliary field is created.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:90
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:73
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:61
Widget for configuring rule based labeling.
Represents a vector layer which manages a vector based data sets.