Class: QgsLayoutObject¶
- class qgis.core.QgsLayoutObject¶
Bases:
PyQt5.QtCore.QObject
,QgsExpressionContextGenerator
A base class for objects which belong to a layout.
New in version 3.0.
QgsLayoutObject(layout:
QgsLayout
) Constructor forQgsLayoutObject
, with the specified parentlayout
.Note
While ownership of a
QgsLayoutObject
is not passed to the layout, classes which are derived fromQgsLayoutObject
(such asQgsLayoutItem
) may transfer their ownership to a layout upon construction.Methods
Creates an expression context relating to the objects' current state.
Returns list of keys stored in custom properties for the object.
Read a custom property from the object.
Returns a reference to the object's property collection, used for data defined overrides.
Returns the layout the object is attached to.
Returns
True
if the specifiedproperty
key is normally associated with the parentQgsLayoutMultiFrame
object instead of a childQgsLayoutFrame
object.Returns the layout object property definitions.
Sets object properties from a DOM element
Refreshes the object, causing a recalculation of any property overrides.
Remove a custom property from the object.
Set a custom property for the object.
Sets the objects's property collection, used for data defined overrides.
Stores object properties within an XML DOM element.
Signals
Emitted when the object's properties change.
Attributes
- AllProperties = 1¶
- AttributeTableSourceLayer = 59¶
- BackgroundColor = 19¶
- BlendMode = 16¶
- class DataDefinedProperty¶
Bases:
int
- EndDateTime = 62¶
- EvaluatedValue = 0¶
- ExcludeFromExports = 17¶
- FrameColor = 18¶
- ItemHeight = 12¶
- ItemRotation = 13¶
- ItemWidth = 11¶
- LegendColumnCount = 54¶
- LegendTitle = 53¶
- MapAtlasMargin = 26¶
- MapCrs = 60¶
- MapGridAnnotationDisplayBottom = 43¶
- MapGridAnnotationDisplayLeft = 40¶
- MapGridAnnotationDisplayRight = 41¶
- MapGridAnnotationDisplayTop = 42¶
- MapGridCrossSize = 38¶
- MapGridEnabled = 30¶
- MapGridFrameDivisionsBottom = 47¶
- MapGridFrameDivisionsLeft = 44¶
- MapGridFrameDivisionsRight = 45¶
- MapGridFrameDivisionsTop = 46¶
- MapGridFrameLineThickness = 39¶
- MapGridFrameMargin = 36¶
- MapGridFrameSize = 35¶
- MapGridIntervalX = 31¶
- MapGridIntervalY = 32¶
- MapGridLabelDistance = 37¶
- MapGridOffsetX = 33¶
- MapGridOffsetY = 34¶
- MapLabelMargin = 29¶
- MapLayers = 27¶
- MapRotation = 20¶
- MapScale = 21¶
- MapStylePreset = 28¶
- MapXMax = 24¶
- MapXMin = 22¶
- MapYMax = 25¶
- MapYMin = 23¶
- NoProperty = 0¶
- NumPages = 6¶
- Opacity = 15¶
- OriginalValue = 1¶
- PageNumber = 8¶
- PaperHeight = 5¶
- PaperOrientation = 7¶
- PaperWidth = 4¶
- PictureSource = 48¶
- PictureSvgBackgroundColor = 49¶
- PictureSvgStrokeColor = 50¶
- PictureSvgStrokeWidth = 51¶
- PositionX = 9¶
- PositionY = 10¶
- PresetPaperSize = 3¶
- class PropertyValueType¶
Bases:
int
- ScalebarFillColor = 55¶
- ScalebarFillColor2 = 56¶
- ScalebarLineColor = 57¶
- ScalebarLineWidth = 58¶
- SourceUrl = 52¶
- StartDateTime = 61¶
- TestProperty = 2¶
- Transparency = 14¶
- changed¶
Emitted when the object’s properties change. [signal]
- childEvent(self, QChildEvent)¶
- connectNotify(self, QMetaMethod)¶
- createExpressionContext(self) QgsExpressionContext ¶
Creates an expression context relating to the objects’ current state. The context includes scopes for global, project and layout properties.
- Return type
- customEvent(self, QEvent)¶
- customProperties(self) List[str] ¶
Returns list of keys stored in custom properties for the object.
See also
See also
See also
- Return type
List[str]
- customProperty(self, key: str, defaultValue: Any = None) Any ¶
Read a custom property from the object.
- Parameters
key (str) – property key
defaultValue (Any = None) – default value to return if property with matching key does not exist
- Return type
Any
- Returns
value of matching property
See also
See also
See also
- dataDefinedProperties(self) QgsPropertyCollection ¶
Returns a reference to the object’s property collection, used for data defined overrides.
See also
- Return type
- disconnectNotify(self, QMetaMethod)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- propertyAssociatesWithParentMultiframe(property: QgsLayoutObject.DataDefinedProperty) bool ¶
Returns
True
if the specifiedproperty
key is normally associated with the parentQgsLayoutMultiFrame
object instead of a childQgsLayoutFrame
object.While some properties like QgsLayoutObject.DataDefinedProperty.PositionX and QgsLayoutObject.DataDefinedProperty.ItemWidth are typically associated with a direct
QgsLayoutItem
subclass (includingQgsLayoutFrame
objects), other properties are instead associated with aQgsLayoutMultiFrame
object (such asQgsLayoutObject
.DataDefinedProperty.SourceUrl orQgsLayoutObject
.DataDefinedProperty.AttributeTableSourceLayer).New in version 3.18.1.
- Parameters
property (QgsLayoutObject.DataDefinedProperty) –
- Return type
bool
- propertyDefinitions() Dict[int, QgsPropertyDefinition] ¶
Returns the layout object property definitions.
- Return type
Dict[int, QgsPropertyDefinition]
- readObjectPropertiesFromElement(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
Sets object properties from a DOM element
- Parameters
parentElement (QDomElement) – is the parent DOM element for the object
document (QDomDocument) – DOM document
context (QgsReadWriteContext) – read write context
- Return type
bool
- Returns
True
if read was successful
See also
- receivers(self, PYQT_SIGNAL) int ¶
- refresh(self)¶
Refreshes the object, causing a recalculation of any property overrides.
- removeCustomProperty(self, key: str)¶
Remove a custom property from the object.
- Parameters
key (str) – property key
See also
See also
See also
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setCustomProperty(self, key: str, value: Any)¶
Set a custom property for the object.
- Parameters
key (str) – property key. If a property with the same key already exists it will be overwritten.
value (Any) – property value
See also
See also
See also
- setDataDefinedProperties(self, collection: QgsPropertyCollection)¶
Sets the objects’s property collection, used for data defined overrides.
- Parameters
collection (QgsPropertyCollection) – property collection. Existing properties will be replaced.
See also
See also
DataDefinedProperty
- timerEvent(self, QTimerEvent)¶
- writeObjectPropertiesToElement(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
Stores object properties within an XML DOM element.
- Parameters
parentElement (QDomElement) – is the parent DOM element to store the object’s properties in
document (QDomDocument) – DOM document
context (QgsReadWriteContext) – read write context
- Return type
bool
- Returns
True
if write was successful
See also