/
qgslabelinggui.h
103 lines (75 loc) · 2.93 KB
/
qgslabelinggui.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/***************************************************************************
qgslabelinggui.h
Smart labeling for vector layers
-------------------
begin : June 2009
copyright : (C) Martin Dobias
email : wonder dot sk at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSLABELINGGUI_H
#define QGSLABELINGGUI_H
#include "qgspallabeling.h"
#include "qgstextformatwidget.h"
#include "qgspropertyoverridebutton.h"
#include "qgis_app.h"
class APP_EXPORT QgsLabelingGui : public QgsTextFormatWidget, private QgsExpressionContextGenerator
{
Q_OBJECT
public:
QgsLabelingGui( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const QgsPalLayerSettings &settings, QWidget *parent );
QgsPalLayerSettings layerSettings();
enum LabelMode
{
NoLabels,
Labels,
ObstaclesOnly,
};
void setLabelMode( LabelMode mode );
void setLayer( QgsMapLayer *layer );
/**
* Deactivate a field from data defined properties and update the
* corresponding button.
*
* \param key The property key to deactivate
*
* \since QGIS 3.0
*/
void deactivateField( QgsPalLayerSettings::Property key );
signals:
void auxiliaryFieldCreated();
public slots:
void updateUi();
void createAuxiliaryField();
protected:
void blockInitSignals( bool block );
void syncDefinedCheckboxFrame( QgsPropertyOverrideButton *ddBtn, QCheckBox *chkBx, QFrame *f );
private slots:
/**
* Called when the geometry type is changed and
* configuration options which only work with a specific
* geometry type should be updated.
*/
void updateGeometryTypeBasedWidgets();
void showGeometryGeneratorExpressionBuilder();
void validateGeometryGeneratorExpression();
private:
QgsVectorLayer *mLayer = nullptr;
const QgsPalLayerSettings &mSettings;
QgsPropertyCollection mDataDefinedProperties;
LabelMode mMode;
QgsFeature mPreviewFeature;
QgsExpressionContext createExpressionContext() const override;
void populateDataDefinedButtons();
void registerDataDefinedButton( QgsPropertyOverrideButton *button, QgsPalLayerSettings::Property key );
QMap<QgsPalLayerSettings::Property, QgsPropertyOverrideButton *> mButtons;
private slots:
void updateProperty();
};
#endif // QGSLABELINGGUI_H