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>]" 84 QgsLayoutObject::initPropertyDefinitions();
85 return sPropertyDefinitions;
92 initPropertyDefinitions();
135 return mLayout->createExpressionContext();
145 if ( parentElement.isNull() )
151 QDomElement objectElement = document.createElement( QStringLiteral(
"LayoutObject" ) );
153 QDomElement ddPropsElement = document.createElement( QStringLiteral(
"dataDefinedProperties" ) );
155 objectElement.appendChild( ddPropsElement );
160 parentElement.appendChild( objectElement );
166 Q_UNUSED( document );
167 if ( parentElement.isNull() )
172 QDomNodeList objectNodeList = parentElement.elementsByTagName( QStringLiteral(
"LayoutObject" ) );
173 if ( objectNodeList.size() < 1 )
177 QDomElement objectElement = objectNodeList.at( 0 ).toElement();
179 QDomNode propsNode = objectElement.namedItem( QStringLiteral(
"dataDefinedProperties" ) );
180 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
Return 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)
QStringList customProperties() const
Return 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
Return 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.