QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgslayoutobject.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutobject.cpp
3  -------------------
4  begin : June 2017
5  copyright : (C) 2017 by Nyall Dawson
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 
18 #include <QPainter>
19 
20 #include "qgslayout.h"
21 #include "qgslayoutrendercontext.h"
22 #include "qgslayoutreportcontext.h"
23 #include "qgslayoutobject.h"
24 #include "qgsfeedback.h"
26 
27 
28 QgsPropertiesDefinition QgsLayoutObject::sPropertyDefinitions;
29 
30 void QgsLayoutObject::initPropertyDefinitions()
31 {
32  if ( !sPropertyDefinitions.isEmpty() )
33  return;
34 
35  sPropertyDefinitions = QgsPropertiesDefinition
36  {
37  { QgsLayoutObject::TestProperty, QgsPropertyDefinition( "dataDefinedProperty", QgsPropertyDefinition::DataTypeString, "invalid property", QString() ) },
38  {
39  QgsLayoutObject::PresetPaperSize, QgsPropertyDefinition( "dataDefinedPaperSize", QgsPropertyDefinition::DataTypeString, QObject::tr( "Paper size" ), QObject::tr( "string " ) + QLatin1String( "[<b>A5</b>|<b>A4</b>|<b>A3</b>|<b>A2</b>|<b>A1</b>|<b>A0</b>"
40  "|<b>B5</b>|<b>B4</b>|<b>B3</b>|<b>B2</b>|<b>B1</b>|<b>B0</b>"
41  "|<b>Legal</b>|<b>Ansi A</b>|<b>Ansi B</b>|<b>Ansi C</b>|<b>Ansi D</b>|<b>Ansi E</b>"
42  "|<b>Arch A</b>|<b>Arch B</b>|<b>Arch C</b>|<b>Arch D</b>|<b>Arch E</b>|<b>Arch E1</b>]"
43  ) )
44  },
45  { QgsLayoutObject::PaperWidth, QgsPropertyDefinition( "dataDefinedPaperWidth", QObject::tr( "Page width" ), QgsPropertyDefinition::DoublePositive ) },
46  { QgsLayoutObject::PaperHeight, QgsPropertyDefinition( "dataDefinedPaperHeight", QObject::tr( "Page height" ), QgsPropertyDefinition::DoublePositive ) },
47  { QgsLayoutObject::NumPages, QgsPropertyDefinition( "dataDefinedNumPages", QObject::tr( "Number of pages" ), QgsPropertyDefinition::IntegerPositive ) },
48  { QgsLayoutObject::PaperOrientation, QgsPropertyDefinition( "dataDefinedPaperOrientation", QgsPropertyDefinition::DataTypeString, QObject::tr( "Symbol size" ), QObject::tr( "string " ) + QLatin1String( "[<b>portrait</b>|<b>landscape</b>]" ) ) },
49  { QgsLayoutObject::PageNumber, QgsPropertyDefinition( "dataDefinedPageNumber", QObject::tr( "Page number" ), QgsPropertyDefinition::IntegerPositive ) },
50  { QgsLayoutObject::PositionX, QgsPropertyDefinition( "dataDefinedPositionX", QObject::tr( "Position (X)" ), QgsPropertyDefinition::Double ) },
51  { QgsLayoutObject::PositionY, QgsPropertyDefinition( "dataDefinedPositionY", QObject::tr( "Position (Y)" ), QgsPropertyDefinition::Double ) },
52  { QgsLayoutObject::ItemWidth, QgsPropertyDefinition( "dataDefinedWidth", QObject::tr( "Width" ), QgsPropertyDefinition::DoublePositive ) },
53  { QgsLayoutObject::ItemHeight, QgsPropertyDefinition( "dataDefinedHeight", QObject::tr( "Height" ), QgsPropertyDefinition::DoublePositive ) },
54  { QgsLayoutObject::ItemRotation, QgsPropertyDefinition( "dataDefinedRotation", QObject::tr( "Rotation angle" ), QgsPropertyDefinition::Rotation ) },
55  { QgsLayoutObject::Transparency, QgsPropertyDefinition( "dataDefinedTransparency", QObject::tr( "Transparency" ), QgsPropertyDefinition::Opacity ) },
56  { QgsLayoutObject::Opacity, QgsPropertyDefinition( "dataDefinedOpacity", QObject::tr( "Opacity" ), QgsPropertyDefinition::Opacity ) },
57  { QgsLayoutObject::BlendMode, QgsPropertyDefinition( "dataDefinedBlendMode", QObject::tr( "Blend mode" ), QgsPropertyDefinition::BlendMode ) },
58  { QgsLayoutObject::ExcludeFromExports, QgsPropertyDefinition( "dataDefinedExcludeExports", QObject::tr( "Exclude item from exports" ), QgsPropertyDefinition::Boolean ) },
59  { QgsLayoutObject::FrameColor, QgsPropertyDefinition( "dataDefinedFrameColor", QObject::tr( "Frame color" ), QgsPropertyDefinition::ColorWithAlpha ) },
60  { QgsLayoutObject::BackgroundColor, QgsPropertyDefinition( "dataDefinedBackgroundColor", QObject::tr( "Background color" ), QgsPropertyDefinition::ColorWithAlpha ) },
61  { QgsLayoutObject::MapRotation, QgsPropertyDefinition( "dataDefinedMapRotation", QObject::tr( "Map rotation" ), QgsPropertyDefinition::Rotation ) },
62  { QgsLayoutObject::MapScale, QgsPropertyDefinition( "dataDefinedMapScale", QObject::tr( "Map scale" ), QgsPropertyDefinition::DoublePositive ) },
63  { QgsLayoutObject::MapXMin, QgsPropertyDefinition( "dataDefinedMapXMin", QObject::tr( "Extent minimum X" ), QgsPropertyDefinition::Double ) },
64  { QgsLayoutObject::MapYMin, QgsPropertyDefinition( "dataDefinedMapYMin", QObject::tr( "Extent minimum Y" ), QgsPropertyDefinition::Double ) },
65  { QgsLayoutObject::MapXMax, QgsPropertyDefinition( "dataDefinedMapXMax", QObject::tr( "Extent maximum X" ), QgsPropertyDefinition::Double ) },
66  { QgsLayoutObject::MapYMax, QgsPropertyDefinition( "dataDefinedMapYMax", QObject::tr( "Extent maximum Y" ), QgsPropertyDefinition::Double ) },
67  { QgsLayoutObject::MapLabelMargin, QgsPropertyDefinition( "dataDefinedMapLabelMargin", QObject::tr( "Label margin" ), QgsPropertyDefinition::DoublePositive ) },
68  { QgsLayoutObject::MapAtlasMargin, QgsPropertyDefinition( "dataDefinedMapAtlasMargin", QObject::tr( "Atlas margin" ), QgsPropertyDefinition::DoublePositive ) },
69  { QgsLayoutObject::MapLayers, QgsPropertyDefinition( "dataDefinedMapLayers", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map Layers" ), tr( "list of map layer names separated by | characters" ) ) },
70  { QgsLayoutObject::MapStylePreset, QgsPropertyDefinition( "dataDefinedMapStylePreset", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map theme" ), tr( "name of an existing map theme (case-sensitive)" ) ) },
71  { QgsLayoutObject::MapGridEnabled, QgsPropertyDefinition( "dataDefinedMapGridEnabled", QObject::tr( "Grid enabled" ), QgsPropertyDefinition::Boolean ) },
72  { QgsLayoutObject::MapGridIntervalX, QgsPropertyDefinition( "dataDefinedMapGridIntervalX", QObject::tr( "Grid interval X" ), QgsPropertyDefinition::DoublePositive ) },
73  { QgsLayoutObject::MapGridIntervalY, QgsPropertyDefinition( "dataDefinedMapGridIntervalY", QObject::tr( "Grid interval Y" ), QgsPropertyDefinition::DoublePositive ) },
74  { QgsLayoutObject::MapGridOffsetX, QgsPropertyDefinition( "dataDefinedMapGridOffsetX", QObject::tr( "Grid offset X" ), QgsPropertyDefinition::Double ) },
75  { QgsLayoutObject::MapGridOffsetY, QgsPropertyDefinition( "dataDefinedMapGridOffsetY", QObject::tr( "Grid offset Y" ), QgsPropertyDefinition::Double ) },
76  { QgsLayoutObject::MapGridFrameSize, QgsPropertyDefinition( "dataDefinedMapGridFrameSize", QObject::tr( "Grid frame size" ), QgsPropertyDefinition::DoublePositive ) },
77  { QgsLayoutObject::MapGridFrameLineThickness, QgsPropertyDefinition( "dataDefinedMapGridFrameLineThickness", QObject::tr( "Grid frame line thickness" ), QgsPropertyDefinition::DoublePositive ) },
78  { QgsLayoutObject::MapGridCrossSize, QgsPropertyDefinition( "dataDefinedMapGridCrossSize", QObject::tr( "Grid cross size" ), QgsPropertyDefinition::DoublePositive ) },
79  { QgsLayoutObject::MapGridFrameMargin, QgsPropertyDefinition( "dataDefinedMapGridFrameMargin", QObject::tr( "Grid frame margin" ), QgsPropertyDefinition::DoublePositive ) },
80  { QgsLayoutObject::MapGridLabelDistance, QgsPropertyDefinition( "dataDefinedMapGridLabelDistance", QObject::tr( "Grid label distance" ), QgsPropertyDefinition::DoublePositive ) },
81  { QgsLayoutObject::MapGridAnnotationDisplayLeft, QgsPropertyDefinition( "dataDefinedMapGridAnnotationDisplayLeft", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid annotation display left" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
82  { QgsLayoutObject::MapGridAnnotationDisplayRight, QgsPropertyDefinition( "dataDefinedMapGridAnnotationDisplayRight", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid annotation display right" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
83  { QgsLayoutObject::MapGridAnnotationDisplayTop, QgsPropertyDefinition( "dataDefinedMapGridAnnotationDisplayTop", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid annotation display top" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
84  { QgsLayoutObject::MapGridAnnotationDisplayBottom, QgsPropertyDefinition( "dataDefinedMapGridAnnotationDisplayBottom", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid annotation display bottom" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
85  { QgsLayoutObject::MapGridFrameDivisionsLeft, QgsPropertyDefinition( "dataDefinedMapGridFrameDivisionsLeft", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid frame divisions display left" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
86  { QgsLayoutObject::MapGridFrameDivisionsRight, QgsPropertyDefinition( "dataDefinedMapGridFrameDivisionsRight", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid frame divisions display right" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
87  { QgsLayoutObject::MapGridFrameDivisionsTop, QgsPropertyDefinition( "dataDefinedMapGridFrameDivisionsTop", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid frame divisions display top" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
88  { QgsLayoutObject::MapGridFrameDivisionsBottom, QgsPropertyDefinition( "dataDefinedMapGridFrameDivisionsBottom", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid frame divisions display bottom" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
89  { QgsLayoutObject::PictureSource, QgsPropertyDefinition( "dataDefinedSource", QObject::tr( "Picture source (URL)" ), QgsPropertyDefinition::String ) },
90  { QgsLayoutObject::SourceUrl, QgsPropertyDefinition( "dataDefinedSourceUrl", QObject::tr( "Source URL" ), QgsPropertyDefinition::String ) },
91  { QgsLayoutObject::PictureSvgBackgroundColor, QgsPropertyDefinition( "dataDefinedSvgBackgroundColor", QObject::tr( "SVG background color" ), QgsPropertyDefinition::ColorWithAlpha ) },
92  { QgsLayoutObject::PictureSvgStrokeColor, QgsPropertyDefinition( "dataDefinedSvgStrokeColor", QObject::tr( "SVG stroke color" ), QgsPropertyDefinition::ColorWithAlpha ) },
93  { QgsLayoutObject::PictureSvgStrokeWidth, QgsPropertyDefinition( "dataDefinedSvgStrokeWidth", QObject::tr( "SVG stroke width" ), QgsPropertyDefinition::StrokeWidth ) },
94  { QgsLayoutObject::LegendTitle, QgsPropertyDefinition( "dataDefinedLegendTitle", QObject::tr( "Legend title" ), QgsPropertyDefinition::String ) },
95  { QgsLayoutObject::LegendColumnCount, QgsPropertyDefinition( "dataDefinedLegendColumns", QObject::tr( "Number of columns" ), QgsPropertyDefinition::IntegerPositiveGreaterZero ) },
96  { QgsLayoutObject::ScalebarFillColor, QgsPropertyDefinition( "dataDefinedScalebarFill", QObject::tr( "Fill color" ), QgsPropertyDefinition::ColorWithAlpha ) },
97  { QgsLayoutObject::ScalebarFillColor2, QgsPropertyDefinition( "dataDefinedScalebarFill2", QObject::tr( "Secondary fill color" ), QgsPropertyDefinition::ColorWithAlpha ) },
98  { QgsLayoutObject::ScalebarLineColor, QgsPropertyDefinition( "dataDefinedScalebarLineColor", QObject::tr( "Line color" ), QgsPropertyDefinition::ColorWithAlpha ) },
99  { QgsLayoutObject::ScalebarLineWidth, QgsPropertyDefinition( "dataDefinedScalebarLineWidth", QObject::tr( "Line width" ), QgsPropertyDefinition::StrokeWidth ) },
100  { QgsLayoutObject::AttributeTableSourceLayer, QgsPropertyDefinition( "dataDefinedAttributeTableSourceLayer", QObject::tr( "Table source layer" ), QgsPropertyDefinition::String ) },
101  { QgsLayoutObject::MapCrs, QgsPropertyDefinition( "dataDefinedCrs", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map CRS" ), QObject::tr( "string representing a CRS, either an authority/id pair (e.g. \"EPSG:4326\"), a proj string prefixes by \"PROJ:\" (e.g. \"PROJ: +proj=...\") or a WKT string prefixed by \"WKT:\" (e.g. \"WKT:GEOGCS[\"WGS 84\"...)" ) ) },
102  { QgsLayoutObject::StartDateTime, QgsPropertyDefinition( "dataDefinedStartDateTime", QObject::tr( "Temporal range start date / time" ), QgsPropertyDefinition::DateTime ) },
103  { QgsLayoutObject::EndDateTime, QgsPropertyDefinition( "dataDefinedEndDateTime", QObject::tr( "Temporal range end date / time" ), QgsPropertyDefinition::DateTime ) },
104  { QgsLayoutObject::ScalebarLeftSegments, QgsPropertyDefinition( "dataDefinedScaleBarLeftSegments", QObject::tr( "Segments to the left of 0" ), QgsPropertyDefinition::IntegerPositive )},
105  { QgsLayoutObject::ScalebarRightSegments, QgsPropertyDefinition( "dataDefinedScaleBarRightSegments", QObject::tr( "Segments to the right of 0" ), QgsPropertyDefinition::IntegerPositive ) },
106  { QgsLayoutObject::ScalebarSegmentWidth, QgsPropertyDefinition( "dataDefinedScalebarSegmentWidth", QObject::tr( "Length of a segment in map units" ), QgsPropertyDefinition::DoublePositive ) },
107  { QgsLayoutObject::ScalebarMinimumWidth, QgsPropertyDefinition( "dataDefinedScalebarMinWidth", QObject::tr( "Minimum length of a segment in mm" ), QgsPropertyDefinition::DoublePositive ) },
108  { QgsLayoutObject::ScalebarMaximumWidth, QgsPropertyDefinition( "dataDefinedScalebarMaxWidth", QObject::tr( "Maximum length of a segment in mm" ), QgsPropertyDefinition::DoublePositive ) },
109  { QgsLayoutObject::ScalebarHeight, QgsPropertyDefinition( "dataDefinedScalebarHeight", QObject::tr( "Scalebar height in mm" ), QgsPropertyDefinition::DoublePositive ) },
110  { QgsLayoutObject::ScalebarSubdivisionHeight, QgsPropertyDefinition( "dataDefinedScalebarSubdivisionHeight", QObject::tr( "Subdivision height in mm" ), QgsPropertyDefinition::DoublePositive ) },
111  { QgsLayoutObject::ScalebarRightSegmentSubdivisions, QgsPropertyDefinition( "dataDefinedScalebarRightSegmentSubdivisions", QObject::tr( "Number of subdivisions in segments to the right of 0" ), QgsPropertyDefinition::IntegerPositive ) },
112  };
113 }
114 
116 {
117  QgsLayoutObject::initPropertyDefinitions();
118  return sPropertyDefinitions;
119 }
120 
122 {
123  switch ( property )
124  {
127  return true;
128 
198  return false;
199  }
200  return false;
201 }
202 
204  : QObject( nullptr )
205  , mLayout( layout )
206 {
207  initPropertyDefinitions();
208 
209  if ( mLayout )
210  {
212  connect( &mLayout->reportContext(), &QgsLayoutReportContext::changed, this, &QgsLayoutObject::refresh );
213  }
214 }
215 
217 {
218  return mLayout.data();
219 }
220 
222 {
223  return mLayout.data();
224 }
225 
226 void QgsLayoutObject::setCustomProperty( const QString &key, const QVariant &value )
227 {
228  mCustomProperties.setValue( key, value );
229 }
230 
231 QVariant QgsLayoutObject::customProperty( const QString &key, const QVariant &defaultValue ) const
232 {
233  return mCustomProperties.value( key, defaultValue );
234 }
235 
236 void QgsLayoutObject::removeCustomProperty( const QString &key )
237 {
238  mCustomProperties.remove( key );
239 }
240 
242 {
243  return mCustomProperties.keys();
244 }
245 
247 {
248  if ( mLayout )
249  {
250  return mLayout->createExpressionContext();
251  }
252  else
253  {
255  }
256 }
257 
258 bool QgsLayoutObject::writeObjectPropertiesToElement( QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext & ) const
259 {
260  if ( parentElement.isNull() )
261  {
262  return false;
263  }
264 
265  //create object element
266  QDomElement objectElement = document.createElement( QStringLiteral( "LayoutObject" ) );
267 
268  QDomElement ddPropsElement = document.createElement( QStringLiteral( "dataDefinedProperties" ) );
269  mDataDefinedProperties.writeXml( ddPropsElement, sPropertyDefinitions );
270  objectElement.appendChild( ddPropsElement );
271 
272  //custom properties
273  mCustomProperties.writeXml( objectElement, document );
274 
275  parentElement.appendChild( objectElement );
276  return true;
277 }
278 
279 bool QgsLayoutObject::readObjectPropertiesFromElement( const QDomElement &parentElement, const QDomDocument &document, const QgsReadWriteContext & )
280 {
281  Q_UNUSED( document )
282  if ( parentElement.isNull() )
283  {
284  return false;
285  }
286 
287  const QDomNodeList objectNodeList = parentElement.elementsByTagName( QStringLiteral( "LayoutObject" ) );
288  if ( objectNodeList.size() < 1 )
289  {
290  return false;
291  }
292  const QDomElement objectElement = objectNodeList.at( 0 ).toElement();
293 
294  const QDomNode propsNode = objectElement.namedItem( QStringLiteral( "dataDefinedProperties" ) );
295  if ( !propsNode.isNull() )
296  {
297  mDataDefinedProperties.readXml( propsNode.toElement(), sPropertyDefinitions );
298  }
299 
300  //custom properties
301  mCustomProperties.readXml( objectElement );
302 
303  return true;
304 }
QgsLayoutObject::ScalebarFillColor2
@ ScalebarFillColor2
Scalebar secondary fill color (deprecated, use data defined properties on scalebar fill symbol 2 inst...
Definition: qgslayoutobject.h:205
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:406
QgsLayoutObject::removeCustomProperty
void removeCustomProperty(const QString &key)
Remove a custom property from the object.
Definition: qgslayoutobject.cpp:236
QgsLayoutObject::customProperty
QVariant customProperty(const QString &key, const QVariant &defaultValue=QVariant()) const
Read a custom property from the object.
Definition: qgslayoutobject.cpp:231
QgsLayoutObject::MapGridAnnotationDisplayTop
@ MapGridAnnotationDisplayTop
Map annotation display top.
Definition: qgslayoutobject.h:179
QgsLayoutObject::layout
const QgsLayout * layout() const
Returns the layout the object is attached to.
Definition: qgslayoutobject.cpp:216
qgsexpressioncontextutils.h
QgsLayoutObject::MapGridFrameLineThickness
@ MapGridFrameLineThickness
Map grid frame line thickness.
Definition: qgslayoutobject.h:176
QgsLayoutObject::ItemRotation
@ ItemRotation
Rotation of item.
Definition: qgslayoutobject.h:149
QgsLayoutObject::StartDateTime
@ StartDateTime
Temporal range's start DateTime.
Definition: qgslayoutobject.h:211
QgsLayoutObject::NoProperty
@ NoProperty
No property.
Definition: qgslayoutobject.h:134
QgsLayoutObject::refresh
virtual void refresh()
Refreshes the object, causing a recalculation of any property overrides.
Definition: qgslayoutobject.h:332
QgsExpressionContextUtils::globalScope
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
Definition: qgsexpressioncontextutils.cpp:40
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:34
QgsLayoutObject::propertyAssociatesWithParentMultiframe
static bool propertyAssociatesWithParentMultiframe(DataDefinedProperty property)
Returns true if the specified property key is normally associated with the parent QgsLayoutMultiFrame...
Definition: qgslayoutobject.cpp:121
QgsPropertyDefinition::BlendMode
@ BlendMode
Blend mode.
Definition: qgsproperty.h:67
QgsLayoutObject::ScalebarRightSegments
@ ScalebarRightSegments
Number of segments on the right of 0 (since QGIS 3.26)
Definition: qgslayoutobject.h:197
QgsLayoutObject::ScalebarLineColor
@ ScalebarLineColor
Scalebar line color (deprecated, use data defined properties on scalebar line symbol instead)
Definition: qgslayoutobject.h:206
QgsPropertyDefinition::DataTypeString
@ DataTypeString
Property requires a string value.
Definition: qgsproperty.h:92
QgsLayoutObject::mCustomProperties
QgsObjectCustomProperties mCustomProperties
Custom properties for object.
Definition: qgslayoutobject.h:368
QgsLayoutObject::PaperWidth
@ PaperWidth
Paper width (deprecated)
Definition: qgslayoutobject.h:139
QgsLayoutObject::PaperOrientation
@ PaperOrientation
Paper orientation.
Definition: qgslayoutobject.h:142
QgsAbstractPropertyCollection::readXml
virtual bool readXml(const QDomElement &collectionElem, const QgsPropertiesDefinition &definitions)
Reads property collection state from an XML element.
Definition: qgspropertycollection.cpp:108
QgsLayoutObject::MapGridAnnotationDisplayLeft
@ MapGridAnnotationDisplayLeft
Map annotation display left.
Definition: qgslayoutobject.h:177
QgsLayoutObject::LegendColumnCount
@ LegendColumnCount
Legend column count.
Definition: qgslayoutobject.h:194
QgsLayoutObject::ItemHeight
@ ItemHeight
Height of item.
Definition: qgslayoutobject.h:148
QgsPropertyDefinition::IntegerPositiveGreaterZero
@ IntegerPositiveGreaterZero
Non-zero positive integer values.
Definition: qgsproperty.h:56
QgsLayoutObject::mDataDefinedProperties
QgsPropertyCollection mDataDefinedProperties
Definition: qgslayoutobject.h:365
QgsPropertyDefinition::Double
@ Double
Double value (including negative values)
Definition: qgsproperty.h:57
QgsObjectCustomProperties::readXml
void readXml(const QDomNode &parentNode, const QString &keyStartsWith=QString())
Read store contents from an XML node.
Definition: qgsobjectcustomproperties.cpp:51
QgsLayout::refreshed
void refreshed()
Emitted when the layout has been refreshed and items should also be refreshed and updated.
QgsLayoutObject::AttributeTableSourceLayer
@ AttributeTableSourceLayer
Attribute table source layer.
Definition: qgslayoutobject.h:209
QgsPropertyDefinition::DateTime
@ DateTime
DateTime value.
Definition: qgsproperty.h:79
QgsLayoutObject::PictureSvgStrokeColor
@ PictureSvgStrokeColor
SVG stroke color.
Definition: qgslayoutobject.h:188
QgsLayoutObject::MapXMin
@ MapXMin
Map extent x minimum.
Definition: qgslayoutobject.h:159
QgsLayoutObject::MapGridOffsetY
@ MapGridOffsetY
Map grid offset Y.
Definition: qgslayoutobject.h:171
QgsLayoutObject::PictureSvgStrokeWidth
@ PictureSvgStrokeWidth
SVG stroke width.
Definition: qgslayoutobject.h:189
QgsPropertyDefinition::String
@ String
Any string value.
Definition: qgsproperty.h:61
QgsLayoutObject::MapCrs
@ MapCrs
Map CRS.
Definition: qgslayoutobject.h:210
QgsLayoutObject::BlendMode
@ BlendMode
Item blend mode.
Definition: qgslayoutobject.h:152
QgsLayoutObject::MapGridFrameDivisionsTop
@ MapGridFrameDivisionsTop
Map frame division display top.
Definition: qgslayoutobject.h:183
QgsLayoutObject::MapYMin
@ MapYMin
Map extent y minimum.
Definition: qgslayoutobject.h:160
QgsPropertyDefinition::Rotation
@ Rotation
Rotation (value between 0-360 degrees)
Definition: qgsproperty.h:60
QgsLayoutObject::QgsLayoutObject
QgsLayoutObject(QgsLayout *layout)
Constructor for QgsLayoutObject, with the specified parent layout.
Definition: qgslayoutobject.cpp:203
QgsLayoutObject::PositionX
@ PositionX
X position on page.
Definition: qgslayoutobject.h:145
QgsLayoutObject::AllProperties
@ AllProperties
All properties for item.
Definition: qgslayoutobject.h:135
QgsLayoutObject::MapGridFrameMargin
@ MapGridFrameMargin
Map grid frame margin.
Definition: qgslayoutobject.h:173
QgsPropertiesDefinition
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
Definition: qgspropertycollection.h:29
QgsLayoutObject::MapGridAnnotationDisplayBottom
@ MapGridAnnotationDisplayBottom
Map annotation display bottom.
Definition: qgslayoutobject.h:180
QgsLayoutObject::ScalebarRightSegmentSubdivisions
@ ScalebarRightSegmentSubdivisions
Number of subdivisions per segment on right of 0 (since QGIS 3.26)
Definition: qgslayoutobject.h:202
QgsLayoutObject::ScalebarMinimumWidth
@ ScalebarMinimumWidth
Scalebar segment minimum width (since QGIS 3.26)
Definition: qgslayoutobject.h:199
QgsLayoutObject::MapRotation
@ MapRotation
Map rotation.
Definition: qgslayoutobject.h:157
QgsPropertyDefinition::ColorWithAlpha
@ ColorWithAlpha
Color with alpha channel.
Definition: qgsproperty.h:64
QgsLayoutObject::MapGridIntervalX
@ MapGridIntervalX
Map grid interval X.
Definition: qgslayoutobject.h:168
QgsLayoutObject::MapXMax
@ MapXMax
Map extent x maximum.
Definition: qgslayoutobject.h:161
QgsLayoutObject::MapYMax
@ MapYMax
Map extent y maximum.
Definition: qgslayoutobject.h:162
QgsLayoutObject::ScalebarSegmentWidth
@ ScalebarSegmentWidth
Scalebar width in map units of a single segment (since QGIS 3.26)
Definition: qgslayoutobject.h:198
QgsLayoutObject::ScalebarLeftSegments
@ ScalebarLeftSegments
Number of segments on the left of 0 (since QGIS 3.26)
Definition: qgslayoutobject.h:196
QgsLayoutObject::MapGridCrossSize
@ MapGridCrossSize
Map grid cross size.
Definition: qgslayoutobject.h:175
QgsObjectCustomProperties::setValue
void setValue(const QString &key, const QVariant &value)
Add an entry to the store with the specified key.
Definition: qgsobjectcustomproperties.cpp:31
QgsLayoutObject::ExcludeFromExports
@ ExcludeFromExports
Exclude item from exports.
Definition: qgslayoutobject.h:153
QgsPropertyDefinition
Definition for a property.
Definition: qgsproperty.h:46
QgsLayoutObject::MapGridOffsetX
@ MapGridOffsetX
Map grid offset X.
Definition: qgslayoutobject.h:170
QgsLayoutReportContext::changed
void changed()
Emitted certain settings in the context is changed, e.g.
QgsLayoutObject::ScalebarHeight
@ ScalebarHeight
Scalebar height (since QGIS 3.26)
Definition: qgslayoutobject.h:201
qgslayout.h
QgsLayoutObject::MapScale
@ MapScale
Map scale.
Definition: qgslayoutobject.h:158
QgsLayoutObject::setCustomProperty
void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for the object.
Definition: qgslayoutobject.cpp:226
QgsLayoutObject::ScalebarLineWidth
@ ScalebarLineWidth
Scalebar line width (deprecated, use data defined properties on scalebar line symbol instead)
Definition: qgslayoutobject.h:207
QgsLayoutObject::MapLabelMargin
@ MapLabelMargin
Map label margin.
Definition: qgslayoutobject.h:166
QgsObjectCustomProperties::remove
void remove(const QString &key)
Removes a key (entry) from the store.
Definition: qgsobjectcustomproperties.cpp:41
QgsLayoutObject::PageNumber
@ PageNumber
Page number for item placement.
Definition: qgslayoutobject.h:144
QgsLayoutObject::PaperHeight
@ PaperHeight
Paper height (deprecated)
Definition: qgslayoutobject.h:140
QgsLayoutObject::MapGridEnabled
@ MapGridEnabled
Map grid enabled.
Definition: qgslayoutobject.h:167
QgsLayoutObject::MapAtlasMargin
@ MapAtlasMargin
Map atlas margin.
Definition: qgslayoutobject.h:163
QgsPropertyDefinition::IntegerPositive
@ IntegerPositive
Positive integer values (including 0)
Definition: qgsproperty.h:55
QgsLayoutObject::createExpressionContext
QgsExpressionContext createExpressionContext() const override
Creates an expression context relating to the objects' current state.
Definition: qgslayoutobject.cpp:246
QgsLayoutObject::LegendTitle
@ LegendTitle
Legend title.
Definition: qgslayoutobject.h:193
QgsLayoutObject::BackgroundColor
@ BackgroundColor
Item background color.
Definition: qgslayoutobject.h:155
qgslayoutrendercontext.h
QgsLayoutObject::readObjectPropertiesFromElement
bool readObjectPropertiesFromElement(const QDomElement &parentElement, const QDomDocument &document, const QgsReadWriteContext &context)
Sets object properties from a DOM element.
Definition: qgslayoutobject.cpp:279
QgsLayoutObject::TestProperty
@ TestProperty
Dummy property with no effect on item.
Definition: qgslayoutobject.h:136
QgsLayoutObject::PositionY
@ PositionY
Y position on page.
Definition: qgslayoutobject.h:146
QgsLayoutObject::mLayout
QPointer< QgsLayout > mLayout
Definition: qgslayoutobject.h:363
QgsPropertyDefinition::Boolean
@ Boolean
Boolean value.
Definition: qgsproperty.h:53
qgslayoutreportcontext.h
QgsLayout
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:50
QgsObjectCustomProperties::keys
QStringList keys() const
Returns a list of all stored keys.
Definition: qgsobjectcustomproperties.cpp:26
QgsLayoutObject::MapGridLabelDistance
@ MapGridLabelDistance
Map grid label distance.
Definition: qgslayoutobject.h:174
QgsObjectCustomProperties::value
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Returns the value for the given key.
Definition: qgsobjectcustomproperties.cpp:36
QgsLayoutObject::customProperties
QStringList customProperties() const
Returns list of keys stored in custom properties for the object.
Definition: qgslayoutobject.cpp:241
QgsLayoutObject::MapGridFrameDivisionsRight
@ MapGridFrameDivisionsRight
Map frame division display right.
Definition: qgslayoutobject.h:182
QgsLayoutObject::MapGridAnnotationDisplayRight
@ MapGridAnnotationDisplayRight
Map annotation display right.
Definition: qgslayoutobject.h:178
QgsLayoutObject::MapGridIntervalY
@ MapGridIntervalY
Map grid interval Y.
Definition: qgslayoutobject.h:169
QgsLayoutObject::Opacity
@ Opacity
Item opacity.
Definition: qgslayoutobject.h:151
QgsPropertyDefinition::Opacity
@ Opacity
Opacity (0-100)
Definition: qgsproperty.h:62
qgslayoutobject.h
QgsLayoutObject::FrameColor
@ FrameColor
Item frame color.
Definition: qgslayoutobject.h:154
QgsLayoutObject::MapGridFrameSize
@ MapGridFrameSize
Map grid frame size.
Definition: qgslayoutobject.h:172
QgsLayoutObject::NumPages
@ NumPages
Number of pages in composition (deprecated)
Definition: qgslayoutobject.h:141
QgsLayoutObject::EndDateTime
@ EndDateTime
Temporal range's end DateTime.
Definition: qgslayoutobject.h:212
QgsLayoutObject::MapGridFrameDivisionsBottom
@ MapGridFrameDivisionsBottom
Map frame division display bottom.
Definition: qgslayoutobject.h:184
QgsLayoutObject::SourceUrl
@ SourceUrl
Html source url.
Definition: qgslayoutobject.h:191
QgsLayoutObject::MapStylePreset
@ MapStylePreset
Layer and style map theme.
Definition: qgslayoutobject.h:165
QgsLayoutObject::MapGridFrameDivisionsLeft
@ MapGridFrameDivisionsLeft
Map frame division display left.
Definition: qgslayoutobject.h:181
qgsfeedback.h
QgsLayoutObject::ScalebarFillColor
@ ScalebarFillColor
Scalebar fill color (deprecated, use data defined properties on scalebar fill symbol 1 instead)
Definition: qgslayoutobject.h:204
QgsLayoutObject::PresetPaperSize
@ PresetPaperSize
Preset paper size for composition.
Definition: qgslayoutobject.h:138
QgsPropertyDefinition::StrokeWidth
@ StrokeWidth
Line stroke width.
Definition: qgsproperty.h:72
QgsLayoutObject::PictureSvgBackgroundColor
@ PictureSvgBackgroundColor
SVG background color.
Definition: qgslayoutobject.h:187
QgsLayoutObject::writeObjectPropertiesToElement
bool writeObjectPropertiesToElement(QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const
Stores object properties within an XML DOM element.
Definition: qgslayoutobject.cpp:258
QgsLayoutObject::ScalebarSubdivisionHeight
@ ScalebarSubdivisionHeight
Scalebar subdivision height (since QGIS 3.26)
Definition: qgslayoutobject.h:203
QgsObjectCustomProperties::writeXml
void writeXml(QDomNode &parentNode, QDomDocument &doc) const
Writes the store contents to an XML node.
Definition: qgsobjectcustomproperties.cpp:130
QgsLayoutObject::ScalebarMaximumWidth
@ ScalebarMaximumWidth
Scalebar segment maximum width (since QGIS 3.26)
Definition: qgslayoutobject.h:200
QgsLayoutObject::Transparency
@ Transparency
Item transparency (deprecated)
Definition: qgslayoutobject.h:150
QgsLayoutObject::DataDefinedProperty
DataDefinedProperty
Data defined properties for different item types.
Definition: qgslayoutobject.h:132
QgsAbstractPropertyCollection::writeXml
virtual bool writeXml(QDomElement &collectionElem, const QgsPropertiesDefinition &definitions) const
Writes the current state of the property collection into an XML element.
Definition: qgspropertycollection.cpp:99
QgsLayoutObject::PictureSource
@ PictureSource
Picture source url.
Definition: qgslayoutobject.h:186
QgsLayoutObject::MapLayers
@ MapLayers
Map layer set.
Definition: qgslayoutobject.h:164
QgsLayoutObject::ItemWidth
@ ItemWidth
Width of item.
Definition: qgslayoutobject.h:147
QgsPropertyDefinition::DoublePositive
@ DoublePositive
Positive double value (including 0)
Definition: qgsproperty.h:58
QgsLayoutObject::propertyDefinitions
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the layout object property definitions.
Definition: qgslayoutobject.cpp:115