QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
src
core
composer
qgscomposerobject.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgscomposerobject.h
3
-------------------
4
begin : July 2014
5
copyright : (C) 2014 by Nyall Dawson,Radim Blazek
6
email : nyall dot dawson at gmail dot 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
#ifndef QGSCOMPOSEROBJECT_H
18
#define QGSCOMPOSEROBJECT_H
19
20
#include "
qgsobjectcustomproperties.h
"
21
#include "
qgsexpressioncontext.h
"
22
#include <QObject>
23
#include <QDomNode>
24
#include <QMap>
25
26
class
QgsComposition
;
27
class
QPainter
;
28
class
QgsDataDefined
;
29
33
class
CORE_EXPORT
QgsComposerObject
:
public
QObject
34
{
35
Q_OBJECT
36
public
:
37
40
enum
DataDefinedProperty
41
{
42
NoProperty = 0,
43
AllProperties
,
44
TestProperty
,
45
//composer page properties
46
PresetPaperSize
,
47
PaperWidth
,
48
PaperHeight
,
49
NumPages
,
50
PaperOrientation
,
51
//general composer item properties
52
PageNumber
,
53
PositionX
,
54
PositionY
,
55
ItemWidth
,
56
ItemHeight
,
57
ItemRotation
,
58
Transparency
,
59
BlendMode
,
60
ExcludeFromExports
,
61
//composer map
62
MapRotation
,
63
MapScale
,
64
MapXMin
,
65
MapYMin
,
66
MapXMax
,
67
MapYMax
,
68
MapAtlasMargin
,
69
MapLayers
,
70
MapStylePreset
,
71
//composer picture
72
PictureSource
,
73
//html item
74
SourceUrl
75
};
76
81
enum
PropertyValueType
82
{
83
EvaluatedValue = 0,
84
OriginalValue
85
};
86
90
QgsComposerObject
(
QgsComposition
* composition );
91
virtual
~
QgsComposerObject
();
92
96
const
QgsComposition
*
composition
()
const
{
return
mComposition; }
97
99
QgsComposition
*
composition
() {
return
mComposition; }
100
105
virtual
bool
writeXML(
QDomElement
& elem,
QDomDocument
& doc )
const
;
106
111
virtual
bool
readXML(
const
QDomElement
& itemElem,
const
QDomDocument
& doc );
112
117
QgsDataDefined
* dataDefinedProperty(
const
DataDefinedProperty
property )
const
;
118
127
void
setDataDefinedProperty(
const
DataDefinedProperty
property,
const
bool
active,
const
bool
useExpression,
const
QString
&expression,
const
QString
&field );
128
137
void
setCustomProperty(
const
QString
&key,
const
QVariant
&value );
138
148
QVariant
customProperty(
const
QString
&key,
const
QVariant
&defaultValue =
QVariant
() )
const
;
149
157
void
removeCustomProperty(
const
QString
&key );
158
165
QStringList
customProperties()
const
;
166
171
virtual
QgsExpressionContext
* createExpressionContext()
const
;
172
173
public
slots:
174
176
virtual
void
repaint();
177
186
virtual
void
refreshDataDefinedProperty(
const
DataDefinedProperty
property = AllProperties,
const
QgsExpressionContext
* context =
nullptr
);
187
188
protected
:
189
190
QgsComposition
*
mComposition
;
191
193
QMap< QgsComposerObject::DataDefinedProperty, QString >
mDataDefinedNames
;
194
196
QgsObjectCustomProperties
mCustomProperties
;
197
206
bool
dataDefinedEvaluate(
const
QgsComposerObject::DataDefinedProperty
property,
QVariant
&expressionValue,
const
QgsExpressionContext
& context =
QgsExpressionContext
() )
const
;
207
208
signals:
212
void
itemChanged();
213
214
private
slots:
218
void
prepareDataDefinedExpressions()
const
;
219
220
private
:
221
223
//mutable since expressions in data defineds need to be preparable
224
mutable
QMap< QgsComposerObject::DataDefinedProperty, QgsDataDefined* >
mDataDefinedProperties;
225
226
friend
class
TestQgsComposerObject;
227
};
228
229
#endif
QgsComposerObject
A base class for objects which belong to a map composition.
Definition:
qgscomposerobject.h:33
QgsDataDefined
A container class for data source field mapping or expression.
Definition:
qgsdatadefined.h:37
QgsComposerObject::mCustomProperties
QgsObjectCustomProperties mCustomProperties
Custom properties for object.
Definition:
qgscomposerobject.h:196
QgsComposerObject::ItemWidth
Definition:
qgscomposerobject.h:55
QgsComposerObject::PictureSource
Definition:
qgscomposerobject.h:72
QMap< QgsComposerObject::DataDefinedProperty, QString >
QgsComposerObject::mDataDefinedNames
QMap< QgsComposerObject::DataDefinedProperty, QString > mDataDefinedNames
Map of data defined properties for the item to string name to use when exporting item to xml...
Definition:
qgscomposerobject.h:193
QgsComposerObject::MapStylePreset
Definition:
qgscomposerobject.h:70
qgsexpressioncontext.h
QgsComposerObject::MapXMax
Definition:
qgscomposerobject.h:66
QgsComposerObject::MapXMin
Definition:
qgscomposerobject.h:64
QgsComposerObject::PaperHeight
Definition:
qgscomposerobject.h:48
QgsComposerObject::DataDefinedProperty
DataDefinedProperty
Data defined properties for different item types.
Definition:
qgscomposerobject.h:40
QgsComposerObject::ItemRotation
Definition:
qgscomposerobject.h:57
QgsComposerObject::PositionX
Definition:
qgscomposerobject.h:53
QgsComposerObject::PositionY
Definition:
qgscomposerobject.h:54
QObject
QgsComposerObject::PaperWidth
Definition:
qgscomposerobject.h:47
QgsComposerObject::ItemHeight
Definition:
qgscomposerobject.h:56
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition:
qgsexpressioncontext.h:250
QPainter
QgsComposerObject::MapYMin
Definition:
qgscomposerobject.h:65
QgsComposerObject::composition
QgsComposition * composition()
Definition:
qgscomposerobject.h:99
QgsComposerObject::MapAtlasMargin
Definition:
qgscomposerobject.h:68
QgsComposerObject::PropertyValueType
PropertyValueType
Specifies whether the value returned by a function should be the original, user set value...
Definition:
qgscomposerobject.h:81
QString
QgsComposerObject::MapRotation
Definition:
qgscomposerobject.h:62
QStringList
QgsComposition
Graphics scene for map printing.
Definition:
qgscomposition.h:76
QDomDocument
QgsComposerObject::MapLayers
Definition:
qgscomposerobject.h:69
QgsComposerObject::MapYMax
Definition:
qgscomposerobject.h:67
QgsComposerObject::mComposition
QgsComposition * mComposition
Definition:
qgscomposerobject.h:190
qgsobjectcustomproperties.h
QgsComposerObject::composition
const QgsComposition * composition() const
Returns the composition the item is attached to.
Definition:
qgscomposerobject.h:96
QgsComposerObject::PaperOrientation
Definition:
qgscomposerobject.h:50
QgsObjectCustomProperties
Simple key-value store (keys = strings, values = variants) that supports loading/saving to/from XML i...
Definition:
qgsobjectcustomproperties.h:33
QgsComposerObject::NumPages
Definition:
qgscomposerobject.h:49
QgsComposerObject::Transparency
Definition:
qgscomposerobject.h:58
QgsComposerObject::PageNumber
Definition:
qgscomposerobject.h:52
QgsComposerObject::TestProperty
Definition:
qgscomposerobject.h:44
QDomElement
QgsComposerObject::MapScale
Definition:
qgscomposerobject.h:63
QgsComposerObject::BlendMode
Definition:
qgscomposerobject.h:59
QgsComposerObject::PresetPaperSize
Definition:
qgscomposerobject.h:46
QgsComposerObject::AllProperties
Definition:
qgscomposerobject.h:43
QVariant
QgsComposerObject::ExcludeFromExports
Definition:
qgscomposerobject.h:60
Generated on Sun Jun 24 2018 11:42:48 for QGIS API Documentation by
1.8.13