QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
qgslegendstyle.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgslegendstyle.h
3
-------------------
4
begin : March 2013
5
copyright : (C) 2013 by Radim Blazek
6
email : radim.blazek@gmail.com
7
***************************************************************************/
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 QGSLEGENDSTYLE_H
19
#define QGSLEGENDSTYLE_H
20
21
#include "qgis_core.h"
22
#include "
qgis_sip.h
"
23
#include "
qgsreadwritecontext.h
"
24
#include "
qgstextformat.h
"
25
26
#include <QDomDocument>
27
#include <QDomElement>
28
#include <QFont>
29
#include <QMap>
30
#include <QString>
31
36
class
CORE_EXPORT
QgsLegendStyle
37
{
38
public
:
39
// TODO QGIS 5.0 - use Qt enum instead
40
42
enum
Side
43
{
44
Top
= 0,
45
Bottom
= 1,
46
Left
= 2,
47
Right
= 3,
48
};
49
50
QgsLegendStyle
();
51
57
Q_DECL_DEPRECATED QFont
font
() const
SIP_DEPRECATED
{
return
mTextFormat.font(); }
58
64
Q_DECL_DEPRECATED
void
setFont(
const
QFont &font )
SIP_DEPRECATED
;
65
71
QgsTextFormat
&
textFormat
() {
return
mTextFormat; }
72
78
QgsTextFormat
textFormat
() const
SIP_SKIP
{
return
mTextFormat; }
79
85
void
setTextFormat
(
const
QgsTextFormat
&format ) { mTextFormat = format; }
86
94
double
margin
(
Side
side )
const
{
return
mMarginMap.value( side ); }
95
103
void
setMargin
(
Side
side,
double
margin
) { mMarginMap[side] =
margin
; }
104
109
void
setMargin(
double
margin );
110
117
Qt::Alignment
alignment
()
const
{
return
mAlignment; }
118
125
void
setAlignment
( Qt::Alignment
alignment
) { mAlignment =
alignment
; }
126
133
double
indent
()
const
{
return
mIndent; }
134
141
void
setIndent
(
double
indent
) { mIndent =
indent
; }
142
147
void
writeXml(
const
QString &name, QDomElement &elem, QDomDocument &doc,
const
QgsReadWriteContext
&context =
QgsReadWriteContext
() )
const
;
148
153
void
readXml(
const
QDomElement &elem,
const
QDomDocument &doc,
const
QgsReadWriteContext
&context =
QgsReadWriteContext
() );
154
161
void
updateDataDefinedProperties(
QgsRenderContext
&context );
162
171
static
QString styleName(
Qgis::LegendComponent
s );
172
177
static
Qgis::LegendComponent
styleFromName(
const
QString &styleName );
178
183
static
QString styleLabel(
Qgis::LegendComponent
s );
184
185
private
:
186
QgsTextFormat
mTextFormat;
187
QMap<Side, double> mMarginMap;
188
Qt::Alignment mAlignment = Qt::AlignLeft;
189
double
mIndent = 0;
190
};
191
192
#endif
Qgis::LegendComponent
LegendComponent
Component of legends which can be styled.
Definition
qgis.h:5088
QgsLegendStyle
Contains detailed styling information relating to how a layout legend should be rendered.
Definition
qgslegendstyle.h:37
QgsLegendStyle::font
Q_DECL_DEPRECATED QFont font() const
Returns the font used for rendering this legend component.
Definition
qgslegendstyle.h:57
QgsLegendStyle::setIndent
void setIndent(double indent)
Sets the indent (in mm) of a group or subgroup.
Definition
qgslegendstyle.h:141
QgsLegendStyle::alignment
Qt::Alignment alignment() const
Returns the alignment for the legend component.
Definition
qgslegendstyle.h:117
QgsLegendStyle::setAlignment
void setAlignment(Qt::Alignment alignment)
Sets the alignment for the legend component.
Definition
qgslegendstyle.h:125
QgsLegendStyle::textFormat
QgsTextFormat & textFormat()
Returns the text format used for rendering this legend component.
Definition
qgslegendstyle.h:71
QgsLegendStyle::setMargin
void setMargin(Side side, double margin)
Sets the margin (in mm) for the specified side of the component.
Definition
qgslegendstyle.h:103
QgsLegendStyle::Side
Side
Margin sides.
Definition
qgslegendstyle.h:43
QgsLegendStyle::Right
@ Right
Right side.
Definition
qgslegendstyle.h:47
QgsLegendStyle::Left
@ Left
Left side.
Definition
qgslegendstyle.h:46
QgsLegendStyle::Bottom
@ Bottom
Bottom side.
Definition
qgslegendstyle.h:45
QgsLegendStyle::Top
@ Top
Top side.
Definition
qgslegendstyle.h:44
QgsLegendStyle::QgsLegendStyle
QgsLegendStyle()
Definition
qgslegendstyle.cpp:34
QgsLegendStyle::textFormat
QgsTextFormat textFormat() const
Returns the text format used for rendering this legend component.
Definition
qgslegendstyle.h:78
QgsLegendStyle::margin
double margin(Side side) const
Returns the margin (in mm) for the specified side of the component.
Definition
qgslegendstyle.h:94
QgsLegendStyle::indent
double indent() const
Returns the indent (in mm) of a group or subgroup.
Definition
qgslegendstyle.h:133
QgsLegendStyle::setTextFormat
void setTextFormat(const QgsTextFormat &format)
Sets the text format used for rendering this legend component.
Definition
qgslegendstyle.h:85
QgsReadWriteContext
A container for the context for various read/write operations on objects.
Definition
qgsreadwritecontext.h:38
QgsRenderContext
Contains information about the context of a rendering operation.
Definition
qgsrendercontext.h:63
QgsTextFormat
Container for all settings relating to text rendering.
Definition
qgstextformat.h:44
qgis_sip.h
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition
qgis_sip.h:113
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:138
qgsreadwritecontext.h
qgstextformat.h
Generated on
for QGIS API Documentation by
1.17.0