Class: QgsLayoutObject¶
- class qgis.core.QgsLayoutObject¶
Bases:
PyQt5.QtCore.QObject
,QgsExpressionContextGenerator
A base class for objects which belong to a layout.
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.Enums
Bases:
enum.IntEnum
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
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
Attributes
- class DataDefinedProperty(value)¶
Bases:
enum.IntEnum
Data defined properties for different item types
NoProperty
: No propertyAllProperties
: All properties for itemTestProperty
: Dummy property with no effect on itemPresetPaperSize
: Preset paper size for compositionPaperWidth
: Paper width (deprecated)PaperHeight
: Paper height (deprecated)NumPages
: Number of pages in composition (deprecated)PaperOrientation
: Paper orientationPageNumber
: Page number for item placementPositionX
: X position on pagePositionY
: Y position on pageItemWidth
: Width of itemItemHeight
: Height of itemItemRotation
: Rotation of itemTransparency
: Item transparency (deprecated)Opacity
: Item opacityBlendMode
: Item blend modeExcludeFromExports
: Exclude item from exportsFrameColor
: Item frame colorBackgroundColor
: Item background colorMarginLeft
: Left margin (since QGIS 3.30)MarginTop
: Top margin (since QGIS 3.30)MarginRight
: Right margin (since QGIS 3.30)MarginBottom
: Bottom margin (since QGIS 3.30)MapRotation
: Map rotationMapScale
: Map scaleMapXMin
: Map extent x minimumMapYMin
: Map extent y minimumMapXMax
: Map extent x maximumMapYMax
: Map extent y maximumMapAtlasMargin
: Map atlas marginMapLayers
: Map layer setMapStylePreset
: Layer and style map themeMapLabelMargin
: Map label marginMapGridEnabled
: Map grid enabledMapGridIntervalX
: Map grid interval XMapGridIntervalY
: Map grid interval YMapGridOffsetX
: Map grid offset XMapGridOffsetY
: Map grid offset YMapGridFrameSize
: Map grid frame sizeMapGridFrameMargin
: Map grid frame marginMapGridLabelDistance
: Map grid label distanceMapGridCrossSize
: Map grid cross sizeMapGridFrameLineThickness
: Map grid frame line thicknessMapGridAnnotationDisplayLeft
: Map annotation display leftMapGridAnnotationDisplayRight
: Map annotation display rightMapGridAnnotationDisplayTop
: Map annotation display topMapGridAnnotationDisplayBottom
: Map annotation display bottomMapGridFrameDivisionsLeft
: Map frame division display leftMapGridFrameDivisionsRight
: Map frame division display rightMapGridFrameDivisionsTop
: Map frame division display topMapGridFrameDivisionsBottom
: Map frame division display bottomMapCrs
: Map CRSStartDateTime
: Temporal range’s start DateTimeEndDateTime
: Temporal range’s end DateTimeMapZRangeLower
: Map frame Z-range lower value (since QGIS 3.38)MapZRangeUpper
: Map frame Z-range lower value (since QGIS 3.38)PictureSource
: Picture source urlPictureSvgBackgroundColor
: SVG background colorPictureSvgStrokeColor
: SVG stroke colorPictureSvgStrokeWidth
: SVG stroke widthSourceUrl
: Html source urlLegendTitle
: Legend titleLegendColumnCount
: Legend column countScalebarLeftSegments
: Number of segments on the left of 0 (since QGIS 3.26)ScalebarRightSegments
: Number of segments on the right of 0 (since QGIS 3.26)ScalebarSegmentWidth
: Scalebar width in map units of a single segment (since QGIS 3.26)ScalebarMinimumWidth
: Scalebar segment minimum width (since QGIS 3.26)ScalebarMaximumWidth
: Scalebar segment maximum width (since QGIS 3.26)ScalebarHeight
: Scalebar height (since QGIS 3.26)ScalebarRightSegmentSubdivisions
: Number of subdivisions per segment on right of 0 (since QGIS 3.26)ScalebarSubdivisionHeight
: Scalebar subdivision height (since QGIS 3.26)ScalebarFillColor
: Scalebar fill color (deprecated, use data defined properties on scalebar fill symbol 1 instead)ScalebarFillColor2
: Scalebar secondary fill color (deprecated, use data defined properties on scalebar fill symbol 2 instead)ScalebarLineColor
: Scalebar line color (deprecated, use data defined properties on scalebar line symbol instead)ScalebarLineWidth
: Scalebar line width (deprecated, use data defined properties on scalebar line symbol instead)AttributeTableSourceLayer
: Attribute table source layerElevationProfileTolerance
: Tolerance distance for elevation profiles (since QGIS 3.30)ElevationProfileDistanceMajorInterval
: Major grid line interval for elevation profile distance axis (since QGIS 3.30)ElevationProfileDistanceMinorInterval
: Minor grid line interval for elevation profile distance axis (since QGIS 3.30)ElevationProfileDistanceLabelInterval
: Label interval for elevation profile distance axis (since QGIS 3.30)ElevationProfileElevationMajorInterval
: Major grid line interval for elevation profile elevation axis (since QGIS 3.30)ElevationProfileElevationMinorInterval
: Minor grid line interval for elevation profile elevation axis (since QGIS 3.30)ElevationProfileElevationLabelInterval
: Label interval for elevation profile elevation axis (since QGIS 3.30)ElevationProfileMinimumDistance
: Minimum distance value for elevation profile (since QGIS 3.30)ElevationProfileMaximumDistance
: Maximum distance value for elevation profile (since QGIS 3.30)ElevationProfileMinimumElevation
: Minimum elevation value for elevation profile (since QGIS 3.30)ElevationProfileMaximumElevation
: Maximum elevation value for elevation profile (since QGIS 3.30)
- EvaluatedValue = 0¶
- OriginalValue = 1¶
- class PropertyValueType¶
Bases:
int
- changed¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_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