QGIS API Documentation
3.4.15-Madeira (e83d02e274)
|
A base class for objects which belong to a layout. More...
#include <qgslayoutobject.h>
Public Types | |
enum | DataDefinedProperty { NoProperty = 0, AllProperties, TestProperty, PresetPaperSize, PaperWidth, PaperHeight, NumPages, PaperOrientation, PageNumber, PositionX, PositionY, ItemWidth, ItemHeight, ItemRotation, Transparency, Opacity, BlendMode, ExcludeFromExports, FrameColor, BackgroundColor, MapRotation, MapScale, MapXMin, MapYMin, MapXMax, MapYMax, MapAtlasMargin, MapLayers, MapStylePreset, PictureSource, PictureSvgBackgroundColor, PictureSvgStrokeColor, PictureSvgStrokeWidth, SourceUrl, LegendTitle, LegendColumnCount, ScalebarFillColor, ScalebarFillColor2, ScalebarLineColor, ScalebarLineWidth, AttributeTableSourceLayer } |
Data defined properties for different item types. More... | |
enum | PropertyValueType { EvaluatedValue = 0, OriginalValue } |
Specifies whether the value returned by a function should be the original, user set value, or the current evaluated value for the property. More... | |
Public Slots | |
virtual void | refresh () |
Refreshes the object, causing a recalculation of any property overrides. More... | |
Signals | |
void | changed () |
Emitted when the object's properties change. More... | |
Public Member Functions | |
QgsLayoutObject (QgsLayout *layout) | |
Constructor for QgsLayoutObject, with the specified parent layout. More... | |
QgsExpressionContext | createExpressionContext () const override |
Creates an expression context relating to the objects' current state. More... | |
QStringList | customProperties () const |
Returns list of keys stored in custom properties for the object. More... | |
QVariant | customProperty (const QString &key, const QVariant &defaultValue=QVariant()) const |
Read a custom property from the object. More... | |
QgsPropertyCollection & | dataDefinedProperties () |
Returns a reference to the object's property collection, used for data defined overrides. More... | |
const QgsPropertyCollection & | dataDefinedProperties () const |
Returns a reference to the object's property collection, used for data defined overrides. More... | |
const QgsLayout * | layout () const |
Returns the layout the object is attached to. More... | |
QgsLayout * | layout () |
Returns the layout the object is attached to. More... | |
void | removeCustomProperty (const QString &key) |
Remove a custom property from the object. More... | |
void | setCustomProperty (const QString &key, const QVariant &value) |
Set a custom property for the object. More... | |
void | setDataDefinedProperties (const QgsPropertyCollection &collection) |
Sets the objects's property collection, used for data defined overrides. More... | |
Public Member Functions inherited from QgsExpressionContextGenerator | |
virtual | ~QgsExpressionContextGenerator ()=default |
Static Public Member Functions | |
static const QgsPropertiesDefinition & | propertyDefinitions () |
Returns the layout object property definitions. More... | |
Protected Member Functions | |
bool | readObjectPropertiesFromElement (const QDomElement &parentElement, const QDomDocument &document, const QgsReadWriteContext &context) |
Sets object properties from a DOM element. More... | |
bool | writeObjectPropertiesToElement (QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const |
Stores object properties within an XML DOM element. More... | |
Protected Attributes | |
QgsObjectCustomProperties | mCustomProperties |
Custom properties for object. More... | |
QgsPropertyCollection | mDataDefinedProperties |
QPointer< QgsLayout > | mLayout |
Friends | |
class | QgsCompositionConverter |
class | TestQgsLayoutObject |
A base class for objects which belong to a layout.
Definition at line 39 of file qgslayoutobject.h.
Data defined properties for different item types.
Definition at line 132 of file qgslayoutobject.h.
Specifies whether the value returned by a function should be the original, user set value, or the current evaluated value for the property.
This may differ if a property has a data defined expression active.
Enumerator | |
---|---|
EvaluatedValue |
Return the current evaluated value for the property. |
OriginalValue |
Return the original, user set value. |
Definition at line 190 of file qgslayoutobject.h.
|
explicit |
Constructor for QgsLayoutObject, with the specified parent layout.
Definition at line 90 of file qgslayoutobject.cpp.
|
signal |
Emitted when the object's properties change.
|
overridevirtual |
Creates an expression context relating to the objects' current state.
The context includes scopes for global, project and layout properties.
Implements QgsExpressionContextGenerator.
Definition at line 133 of file qgslayoutobject.cpp.
QStringList QgsLayoutObject::customProperties | ( | ) | const |
Returns list of keys stored in custom properties for the object.
Definition at line 128 of file qgslayoutobject.cpp.
QVariant QgsLayoutObject::customProperty | ( | const QString & | key, |
const QVariant & | defaultValue = QVariant() |
||
) | const |
Read a custom property from the object.
key | property key |
defaultValue | default value to return if property with matching key does not exist |
Definition at line 118 of file qgslayoutobject.cpp.
|
inline |
Returns a reference to the object's property collection, used for data defined overrides.
Definition at line 223 of file qgslayoutobject.h.
|
inline |
Returns a reference to the object's property collection, used for data defined overrides.
Definition at line 230 of file qgslayoutobject.h.
const QgsLayout * QgsLayoutObject::layout | ( | ) | const |
Returns the layout the object is attached to.
Definition at line 103 of file qgslayoutobject.cpp.
QgsLayout * QgsLayoutObject::layout | ( | ) |
Returns the layout the object is attached to.
Definition at line 108 of file qgslayoutobject.cpp.
|
static |
Returns the layout object property definitions.
Definition at line 84 of file qgslayoutobject.cpp.
|
protected |
Sets object properties from a DOM element.
parentElement | is the parent DOM element for the object |
document | DOM document |
context | read write context |
Definition at line 166 of file qgslayoutobject.cpp.
|
inlinevirtualslot |
Refreshes the object, causing a recalculation of any property overrides.
Definition at line 290 of file qgslayoutobject.h.
void QgsLayoutObject::removeCustomProperty | ( | const QString & | key | ) |
Remove a custom property from the object.
key | property key |
Definition at line 123 of file qgslayoutobject.cpp.
void QgsLayoutObject::setCustomProperty | ( | const QString & | key, |
const QVariant & | value | ||
) |
Set a custom property for the object.
key | property key. If a property with the same key already exists it will be overwritten. |
value | property value |
Definition at line 113 of file qgslayoutobject.cpp.
|
inline |
Sets the objects's property collection, used for data defined overrides.
collection | property collection. Existing properties will be replaced. |
Definition at line 238 of file qgslayoutobject.h.
|
protected |
Stores object properties within an XML DOM element.
parentElement | is the parent DOM element to store the object's properties in |
document | DOM document |
context | read write context |
Definition at line 145 of file qgslayoutobject.cpp.
|
friend |
Definition at line 336 of file qgslayoutobject.h.
|
friend |
Definition at line 335 of file qgslayoutobject.h.
|
protected |
Custom properties for object.
Definition at line 326 of file qgslayoutobject.h.
|
protected |
Definition at line 323 of file qgslayoutobject.h.
|
protected |
Definition at line 321 of file qgslayoutobject.h.