30 void QgsLayoutObject::initPropertyDefinitions()
32 if ( !sPropertyDefinitions.isEmpty() )
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>]" 88 QgsLayoutObject::initPropertyDefinitions();
89 return sPropertyDefinitions;
96 initPropertyDefinitions();
139 return mLayout->createExpressionContext();
149 if ( parentElement.isNull() )
155 QDomElement objectElement = document.createElement( QStringLiteral(
"LayoutObject" ) );
157 QDomElement ddPropsElement = document.createElement( QStringLiteral(
"dataDefinedProperties" ) );
159 objectElement.appendChild( ddPropsElement );
164 parentElement.appendChild( objectElement );
170 Q_UNUSED( document );
171 if ( parentElement.isNull() )
176 QDomNodeList objectNodeList = parentElement.elementsByTagName( QStringLiteral(
"LayoutObject" ) );
177 if ( objectNodeList.size() < 1 )
181 QDomElement objectElement = objectNodeList.at( 0 ).toElement();
183 QDomNode propsNode = objectElement.namedItem( QStringLiteral(
"dataDefinedProperties" ) );
184 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.