QGIS API Documentation  3.2.0-Bonn (bc43194)
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 : [email protected]
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 <QFont>
22 #include <QMap>
23 #include <QString>
24 #include <QDomElement>
25 #include <QDomDocument>
26 
27 #include "qgis_core.h"
28 #include "qgis.h"
29 
34 class CORE_EXPORT QgsLegendStyle
35 {
36  public:
37  enum Style
38  {
45  SymbolLabel
46  };
47 
49  enum Side
50  {
51  Top = 0,
52  Bottom = 1,
53  Left = 2,
54  Right = 3
55  };
56 
58 
62  QFont font() const { return mFont; }
63 
67  void setFont( const QFont &font ) { mFont = font; }
68 
75  SIP_SKIP QFont &rfont() { return mFont; }
76 
77  double margin( Side side ) { return mMarginMap.value( side ); }
78  void setMargin( Side side, double margin ) { mMarginMap[side] = margin; }
79 
81  void setMargin( double margin );
82 
83  void writeXml( const QString &name, QDomElement &elem, QDomDocument &doc ) const;
84 
85  void readXml( const QDomElement &elem, const QDomDocument &doc );
86 
88  static QString styleName( Style s );
89 
91  static Style styleFromName( const QString &styleName );
92 
94  static QString styleLabel( Style s );
95 
96  private:
97  QFont mFont;
99  QMap<Side, double> mMarginMap;
100 };
101 
102 #endif
double margin(Side side)
QFont font() const
The font for this style.
Composer legend components style.
Should not happen, only if corrupted project file.
void setFont(const QFont &font)
The font for this style.
#define SIP_SKIP
Definition: qgis_sip.h:119
Symbol without label.
void setMargin(Side side, double margin)
Side
Margin side.
Special style, item is hidden including margins around.
QFont & rfont()
Modifiable reference to font.