QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
src
gui
labeling
qgslabelinggui.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgslabelinggui.h
3
Smart labeling for vector layers
4
-------------------
5
begin : June 2009
6
copyright : (C) Martin Dobias
7
email : wonder dot sk at gmail dot com
8
9
***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#ifndef QGSLABELINGGUI_H
19
#define QGSLABELINGGUI_H
20
21
#include "
qgspallabeling.h
"
22
#include "
qgstextformatwidget.h
"
23
#include "
qgspropertyoverridebutton.h
"
24
#include "qgis_gui.h"
25
26
class
QDialogButtonBox;
27
28
#define SIP_NO_FILE
29
31
32
class
GUI_EXPORT QgsLabelingGui :
public
QgsTextFormatWidget
33
{
34
Q_OBJECT
35
36
public
:
37
QgsLabelingGui(
QgsVectorLayer
*layer,
QgsMapCanvas
*mapCanvas,
const
QgsPalLayerSettings
&settings, QWidget *parent =
nullptr
,
38
QgsWkbTypes::GeometryType
geomType =
QgsWkbTypes::UnknownGeometry
);
39
40
QgsPalLayerSettings
layerSettings();
41
42
enum
LabelMode
43
{
44
NoLabels,
45
Labels,
46
ObstaclesOnly,
47
};
48
49
void
setLabelMode( LabelMode mode );
50
51
void
setLayer(
QgsMapLayer
*layer );
52
53
void
setSettings(
const
QgsPalLayerSettings
&settings );
54
55
void
setContext
(
const
QgsSymbolWidgetContext
&context )
override
;
56
57
public
slots:
58
59
void
updateUi();
60
61
protected
slots:
62
void
setFormatFromStyle
(
const
QString &name,
QgsStyle::StyleEntity
type )
override
;
63
void
saveFormat
()
override
;
64
65
protected
:
66
void
blockInitSignals(
bool
block );
67
void
syncDefinedCheckboxFrame(
QgsPropertyOverrideButton
*ddBtn, QCheckBox *chkBx, QFrame *f );
68
bool
eventFilter( QObject *
object
, QEvent *event )
override
;
69
70
private
slots:
71
77
void
updateGeometryTypeBasedWidgets();
78
void
showGeometryGeneratorExpressionBuilder();
79
void
validateGeometryGeneratorExpression();
80
void
determineGeometryGeneratorType();
81
85
void
calloutTypeChanged();
86
87
private
:
88
89
QgsPalLayerSettings
mSettings;
90
LabelMode mMode;
91
QgsFeature
mPreviewFeature;
92
QgsMapCanvas
*mCanvas =
nullptr
;
93
94
QgsLabelObstacleSettings
mObstacleSettings;
95
QgsLabelLineSettings
mLineSettings;
96
97
QgsExpressionContext
createExpressionContext
()
const override
;
98
99
private
slots:
100
101
void
initCalloutWidgets();
102
void
updateCalloutWidget(
QgsCallout
*callout );
103
void
showObstacleSettings();
104
void
showLineAnchorSettings();
105
106
};
107
108
class
GUI_EXPORT QgsLabelSettingsDialog :
public
QDialog
109
{
110
Q_OBJECT
111
112
public
:
113
114
QgsLabelSettingsDialog(
const
QgsPalLayerSettings
&settings,
QgsVectorLayer
*layer,
QgsMapCanvas
*mapCanvas, QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
,
115
QgsWkbTypes::GeometryType
geomType =
QgsWkbTypes::UnknownGeometry
);
116
117
QgsPalLayerSettings
settings()
const
{
return
mWidget->layerSettings(); }
118
122
QDialogButtonBox *buttonBox()
const
;
123
124
private
:
125
126
QgsLabelingGui *mWidget =
nullptr
;
127
QDialogButtonBox *mButtonBox =
nullptr
;
128
129
private
slots:
130
void
showHelp();
131
132
};
133
135
136
#endif // QGSLABELINGGUI_H
137
138
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition:
qgsexpressioncontext.h:370
QgsTextFormatWidget::createExpressionContext
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Definition:
qgstextformatwidget.cpp:2025
qgspallabeling.h
QgsCallout
Abstract base class for callout renderers.
Definition:
qgscallout.h:47
QgsPalLayerSettings
Definition:
qgspallabeling.h:207
QgsSymbolWidgetContext
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
Definition:
qgssymbolwidgetcontext.h:36
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition:
qgsmapcanvas.h:85
QgsLabelObstacleSettings
Contains settings related to how the label engine treats features as obstacles.
Definition:
qgslabelobstaclesettings.h:35
QgsPropertyOverrideButton
A button for controlling property overrides which may apply to a widget.
Definition:
qgspropertyoverridebutton.h:51
qgstextformatwidget.h
QgsTextFormatWidget::setFormatFromStyle
virtual void setFormatFromStyle(const QString &name, QgsStyle::StyleEntity type)
Sets the current text settings from a style entry.
Definition:
qgstextformatwidget.cpp:1818
QgsTextFormatWidget
A widget for customizing text formatting settings.
Definition:
qgstextformatwidget.h:51
QgsTextFormatWidget::setContext
virtual void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the widget is shown, e.g., the associated map canvas and expression context...
Definition:
qgstextformatwidget.cpp:1164
QgsLabelLineSettings
Contains settings related to how the label engine places and formats labels for line features (or pol...
Definition:
qgslabellinesettings.h:40
QgsWkbTypes::GeometryType
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition:
qgswkbtypes.h:141
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition:
qgsvectorlayer.h:387
QgsTextFormatWidget::saveFormat
virtual void saveFormat()
Saves the current text settings to a style entry.
Definition:
qgstextformatwidget.cpp:1852
QgsMapLayer
Base class for all map layer types.
Definition:
qgsmaplayer.h:83
QgsWkbTypes::UnknownGeometry
@ UnknownGeometry
Definition:
qgswkbtypes.h:145
QgsFeature
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition:
qgsfeature.h:56
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition:
qgis_sip.h:53
qgspropertyoverridebutton.h
QgsStyle::StyleEntity
StyleEntity
Enum for Entities involved in a style.
Definition:
qgsstyle.h:179
Generated on Sat Oct 24 2020 17:43:09 for QGIS API Documentation by
1.8.20