28 void QgsLayoutObject::initPropertyDefinitions()
30 if ( !sPropertyDefinitions.isEmpty() )
38 "<b>B5</b>|<b>B4</b>|<b>B3</b>|<b>B2</b>|<b>B1</b>|<b>B0</b>" 39 "<b>Legal</b>|<b>Ansi A</b>|<b>Ansi B</b>|<b>Ansi C</b>|<b>Ansi D</b>|<b>Ansi E</b>" 40 "<b>Arch A</b>|<b>Arch B</b>|<b>Arch C</b>|<b>Arch D</b>|<b>Arch E</b>|<b>Arch E1</b>]" 85 QgsLayoutObject::initPropertyDefinitions();
86 return sPropertyDefinitions;
93 initPropertyDefinitions();
136 return mLayout->createExpressionContext();
146 if ( parentElement.isNull() )
152 QDomElement objectElement = document.createElement( QStringLiteral(
"LayoutObject" ) );
154 QDomElement ddPropsElement = document.createElement( QStringLiteral(
"dataDefinedProperties" ) );
156 objectElement.appendChild( ddPropsElement );
161 parentElement.appendChild( objectElement );
167 Q_UNUSED( document );
168 if ( parentElement.isNull() )
173 QDomNodeList objectNodeList = parentElement.elementsByTagName( QStringLiteral(
"LayoutObject" ) );
174 if ( objectNodeList.size() < 1 )
178 QDomElement objectElement = objectNodeList.at( 0 ).toElement();
180 QDomNode propsNode = objectElement.namedItem( QStringLiteral(
"dataDefinedProperties" ) );
181 if ( !propsNode.isNull() )
The class is used as a container of context for various read/write operations on other objects...
QgsExpressionContext createExpressionContext() const override
Creates an expression context relating to the objects' current state.
Positive integer values (including 0)
bool readObjectPropertiesFromElement(const QDomElement &parentElement, const QDomDocument &document, const QgsReadWriteContext &context)
Sets object properties from a DOM element.
void readXml(const QDomNode &parentNode, const QString &keyStartsWith=QString())
Read store contents from XML.
virtual bool readXml(const QDomElement &collectionElem, const QgsPropertiesDefinition &definitions)
Reads property collection state from an XML element.
Layer and style map theme.
QgsObjectCustomProperties mCustomProperties
Custom properties for object.
Exclude item from exports.
void changed()
Emitted certain settings in the context is changed, e.g.
Non-zero positive integer values.
void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for the object.
QVariant customProperty(const QString &key, const QVariant &defaultValue=QVariant()) const
Read a custom property from the object.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Returns value for the given key. If the key is not stored, default value will be used.
Color with alpha channel.
void writeXml(QDomNode &parentNode, QDomDocument &doc) const
Write store contents to XML.
Positive double value (including 0)
void remove(const QString &key)
Remove a key (entry) from the store.
Rotation (value between 0-360 degrees)
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the layout object property definitions.
Dummy property with no effect on item.
Number of pages in composition (deprecated)
Attribute table source layer.
QStringList customProperties() const
Returns list of keys stored in custom properties for the object.
void setValue(const QString &key, const QVariant &value)
Add an entry to the store. If the entry with the keys exists already, it will be overwritten.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context...
Scalebar secondary fill color.
QgsPropertyCollection mDataDefinedProperties
const QgsLayout * layout() const
Returns the layout the object is attached to.
Item transparency (deprecated)
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QPointer< QgsLayout > mLayout
Page number for item placement.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
QStringList keys() const
Returns list of stored keys.
Double value (including negative values)
Definition for a property.
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
bool writeObjectPropertiesToElement(QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const
Stores object properties within an XML DOM element.
void removeCustomProperty(const QString &key)
Remove a custom property from the object.
Property requires a string value.
void refreshed()
Is emitted when the layout has been refreshed and items should also be refreshed and updated...
Preset paper size for composition.
Paper height (deprecated)
QgsLayoutObject(QgsLayout *layout)
Constructor for QgsLayoutObject, with the specified parent layout.
virtual void refresh()
Refreshes the object, causing a recalculation of any property overrides.
virtual bool writeXml(QDomElement &collectionElem, const QgsPropertiesDefinition &definitions) const
Writes the current state of the property collection into an XML element.