Subgroup: Layout
Class: QgsLayoutItemPicture¶
-
class
qgis.core.
QgsLayoutItemPicture
¶ Bases:
qgis._core.QgsLayoutItem
A layout item subclass that displays SVG files or raster format images (jpg, png, …).
New in version 3.0: Methods
acceptDrops
acceptHoverEvents
acceptTouchEvents
acceptedMouseButtons
adjustPointForReferencePosition
advance
applyDataDefinedSize
applyItemSizeConstraint
attemptMove
Attempts to move the item to a specified point
.attemptMoveBy
Attempts to shift the item’s position by a specified deltaX
anddeltaY
, in layout units.attemptResize
Attempts to resize the item to a specified target size
.attemptSetSceneRect
Attempts to update the item’s position and size to match the passed rect
in layout coordinates.backgroundColor
Returns the background color for this item. beginCommand
Starts new undo command for this item. blendMode
Returns the item’s composition blending mode. blockSignals
boundingRect
boundingRegion
boundingRegionGranularity
brush
cacheMode
cancelCommand
Cancels the current item command and discards it. childEvent
childItems
children
childrenBoundingRect
cleanup
Called just before a batch of items are deleted, allowing them to run cleanup tasks. clearFocus
clipPath
collidesWithItem
collidesWithPath
collidingItems
commonAncestorItem
connectNotify
contains
containsAdvancedEffects
contextMenuEvent
create
Returns a new picture item for the specified layout
.createCommand
createExpressionContext
cursor
customEvent
customProperties
Return list of keys stored in custom properties for the object. customProperty
Read a custom property from the object. data
dataDefinedProperties
Returns a reference to the object’s property collection, used for data defined overrides. deleteLater
deviceTransform
disconnect
disconnectNotify
displayName
Get item display name. dragEnterEvent
dragLeaveEvent
dragMoveEvent
draw
drawBackground
drawDebugRect
drawFrame
dropEvent
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
effectiveOpacity
endCommand
Completes the current item command and push it onto the layout’s undo stack. ensureVisible
ensureVisible(self, float, float, float, float, xMargin: int = 50, yMargin: int = 50) estimatedFrameBleed
Returns the estimated amount the item’s frame bleeds outside the item’s actual rectangle. event
eventFilter
excludeFromExports
Returns whether the item should be excluded from layout exports and prints. filtersChildEvents
finalizeRestoreFromXml
findChild
findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject findChildren
findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] fixedSize
Returns the fixed size of the item, if applicable, or an empty size if item can be freely resized. flags
focusInEvent
focusItem
focusOutEvent
focusProxy
frameEnabled
Returns true if the item includes a frame. frameJoinStyle
Returns the join style used for drawing the item’s frame. frameStrokeColor
Returns the frame’s stroke color. frameStrokeWidth
Returns the frame’s stroke width. grabKeyboard
grabMouse
graphicsEffect
group
hasBackground
Returns true if the item has a background. hasCursor
hasFocus
hide
hoverEnterEvent
hoverLeaveEvent
hoverMoveEvent
icon
id
Returns the item’s ID name. inherits
inputMethodEvent
inputMethodHints
inputMethodQuery
installEventFilter
installSceneEventFilter
invalidateCache
Forces a deferred update of any cached image the item uses. isActive
isAncestorOf
isBlockedByModalPanel
isClipped
isEnabled
isGroupMember
Returns true if the item is part of a QgsLayoutItemGroup group. isLocked
Returns true if the item is locked, and cannot be interacted with using the mouse. isObscured
isObscured(self, float, float, float, float) -> bool isObscuredBy
isPanel
isSelected
isSignalConnected
isUnderMouse
isVisible
isVisibleTo
isWidget
isWidgetType
isWindow
isWindowType
itemChange
itemOpacity
Returns the item’s opacity. itemRotation
Returns the current rotation for the item, in degrees clockwise. itemTransform
keyPressEvent
keyReleaseEvent
killTimer
layout
Returns the layout the object is attached to. linkedMap
Returns the linked rotation map, if set. mapFromItem
mapFromItem(self, QGraphicsItem, QRectF) -> QPolygonF mapFromParent
mapFromParent(self, QRectF) -> QPolygonF mapFromScene
mapFromScene(self, QRectF) -> QPolygonF mapRectFromItem
mapRectFromItem(self, QGraphicsItem, float, float, float, float) -> QRectF mapRectFromParent
mapRectFromParent(self, float, float, float, float) -> QRectF mapRectFromScene
mapRectFromScene(self, float, float, float, float) -> QRectF mapRectToItem
mapRectToItem(self, QGraphicsItem, float, float, float, float) -> QRectF mapRectToParent
mapRectToParent(self, float, float, float, float) -> QRectF mapRectToScene
mapRectToScene(self, float, float, float, float) -> QRectF mapToItem
mapToItem(self, QGraphicsItem, QRectF) -> QPolygonF mapToParent
mapToParent(self, QRectF) -> QPolygonF mapToScene
mapToScene(self, QRectF) -> QPolygonF metaObject
minimumSize
Returns the minimum allowed size of the item, if applicable, or an empty size if item can be freely resized. mode
Returns the current picture mode (image format). mouseDoubleClickEvent
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
moveBy
moveContent
Moves the content of the item, by a specified dx
anddy
in layout units.moveToThread
northMode
Returns the mode used to align the picture to a map’s North. northOffset
Returns the offset added to the picture’s rotation from a map’s North. numberExportLayers
Returns the number of layers that this item requires for exporting during layered exports (e.g. objectName
opacity
opaqueArea
page
Returns the page the item is currently on, with the first page returning 0. pagePos
Returns the item’s position (in layout units) relative to the top left corner of its current page. pagePositionWithUnits
Returns the item’s position (in item units) relative to the top left corner of its current page. paint
Handles preparing a paint surface for the layout item and painting the item’s content. panel
panelModality
parent
parentGroup
Returns the item’s parent group, if the item is part of a QgsLayoutItemGroup group. parentItem
parentObject
parentWidget
pen
pictureAnchor
Returns the picture’s current anchor, which controls how it is placed within the picture item’s frame. picturePath
Returns the path of the source image. pictureRotation
Returns the rotation used for drawing the picture within the item’s frame, in degrees clockwise. pos
positionAtReferencePoint
positionWithUnits
Returns the item’s current position, including units. prepareGeometryChange
property
propertyDefinitions
Returns the layout object property definitions. pyqtConfigure
Each keyword argument is either the name of a Qt property or a Qt signal. readObjectPropertiesFromElement
readPropertiesFromElement
readXml
Sets the item state from a DOM element. recalculateSize
Forces a recalculation of the picture’s frame size receivers
rect
rectWithFrame
Returns the item’s rectangular bounds, including any bleed caused by the item’s frame. redraw
Triggers a redraw (update) of the item. referencePoint
Returns the reference point for positioning of the layout item. refresh
Refreshes the item, causing a recalculation of any property overrides and recalculation of its position and size. refreshBackgroundColor
refreshBlendMode
refreshDataDefinedProperty
refreshFrame
refreshItemPosition
refreshItemRotation
refreshItemSize
refreshOpacity
refreshPicture
Recalculates the source image (if using an expression for picture’s source) and reloads and redraws the picture. removeCustomProperty
Remove a custom property from the object. removeEventFilter
removeSceneEventFilter
requiresRasterization
Returns true if the item is drawn in such a way that forces the whole layout to be rasterized when exporting to vector formats. resetTransform
resizeMode
Returns the resize mode used for drawing the picture within the composer item’s frame. rotateItem
Rotates the item by a specified angle
in degrees clockwise around a specified reference point.rotation
scale
scene
sceneBoundingRect
sceneEvent
sceneEventFilter
scenePos
sceneTransform
scroll
sender
senderSignalIndex
setAcceptDrops
setAcceptHoverEvents
setAcceptTouchEvents
setAcceptedMouseButtons
setActive
setBackgroundColor
Sets the background color
for this item.setBackgroundEnabled
Sets whether this item has a background drawn under it or not. setBlendMode
Sets the item’s composition blending mode
.setBoundingRegionGranularity
setBrush
setCacheMode
setCursor
setCustomProperty
Set a custom property for the object. setData
setDataDefinedProperties
Sets the objects’s property collection, used for data defined overrides. setEnabled
setExcludeFromExports
Sets whether the item should be excluded from layout exports and prints. setFiltersChildEvents
setFixedSize
setFlag
setFlags
setFocus
setFocusProxy
setFrameEnabled
Sets whether this item has a frame drawn around it or not. setFrameJoinStyle
Sets the join style
used when drawing the item’s frame.setFrameStrokeColor
Sets the frame stroke color
.setFrameStrokeWidth
Sets the frame stroke width
.setGraphicsEffect
setGroup
setId
Set the item’s id
name.setInputMethodHints
setItemOpacity
Sets the item’s opacity
.setItemRotation
Sets the layout item’s rotation
, in degrees clockwise.setLinkedMap
Sets the map
object for rotation.setLocked
Sets whether the item is locked
, preventing mouse interactions with the item.setMinimumSize
setMoveContentPreviewOffset
Sets temporary offset for the item, by a specified dx
anddy
in layout units.setNorthMode
Sets the mode
used to align the picture to a map’s North.setNorthOffset
Sets the offset
added to the picture’s rotation from a map’s North.setObjectName
setOpacity
setPanelModality
setParent
setParentGroup
Sets the item’s parent group
.setParentItem
setPen
setPictureAnchor
Sets the picture’s anchor
point, which controls how it is placed within the picture item’s frame.setPicturePath
Sets the source path
of the image (may be svg or a raster format).setPictureRotation
Sets the picture rotation
within the item bounds, in degrees clockwise.setPos
setPos(self, float, float) setProperty
setRect
setRect(self, float, float, float, float) setReferencePoint
Sets the reference point
for positioning of the layout item.setResizeMode
Sets the resize mode
used for drawing the picture within the item bounds.setRotation
setScale
setSelected
Sets whether the item should be selected. setSvgFillColor
Sets the fill color
used for parametrized SVG files.setSvgStrokeColor
Sets the stroke color
used for parametrized SVG files.setSvgStrokeWidth
Sets the stroke width
(in layout units) used for parametrized SVG files.setToolTip
setTransform
setTransformOriginPoint
setTransformOriginPoint(self, float, float) setTransformations
setVisibility
Sets whether the item is visible
.setVisible
setX
setY
setZValue
shape
shouldDrawItem
Returns whether the item should be drawn in the current context. show
signalsBlocked
sizeWithUnits
Returns the item’s current size, including units. stackBefore
startTimer
svgFillColor
Returns the fill color used for parametrized SVG files. svgStrokeColor
Returns the stroke color used for parametrized SVG files. svgStrokeWidth
Returns the stroke width (in layout units) used for parametrized SVG files. templateUuid
Returns the item’s original identification string. thread
timerEvent
toGraphicsObject
toolTip
topLeftToReferencePoint
topLevelItem
topLevelWidget
tr
transform
transformOriginPoint
transformations
type
ungrabKeyboard
ungrabMouse
unsetCursor
update
update(self, float, float, float, float) updateMicroFocus
uuid
Returns the item identification string. wheelEvent
window
writeObjectPropertiesToElement
writePropertiesToElement
writeXml
Stores the item state in a DOM element. x
y
zValue
zoomContent
Zooms content of item. Attributes
AllProperties
BackgroundColor
BlendMode
Clip
DeviceCoordinateCache
EvaluatedValue
ExcludeFromExports
FormatRaster
FormatSVG
FormatUnknown
FrameColor
FrameToImageSize
GridNorth
ItemAcceptsInputMethod
ItemChildAddedChange
ItemChildRemovedChange
ItemClipsChildrenToShape
ItemClipsToShape
ItemContainsChildrenInShape
ItemCoordinateCache
ItemCursorChange
ItemCursorHasChanged
ItemDoesntPropagateOpacityToChildren
ItemEnabledChange
ItemEnabledHasChanged
ItemFlagsChange
ItemFlagsHaveChanged
ItemHasNoContents
ItemHeight
ItemIgnoresParentOpacity
ItemIgnoresTransformations
ItemIsFocusable
ItemIsMovable
ItemIsPanel
ItemIsSelectable
ItemMatrixChange
ItemNegativeZStacksBehindParent
ItemOpacityChange
ItemOpacityHasChanged
ItemParentChange
ItemParentHasChanged
ItemPositionChange
ItemPositionHasChanged
ItemRotation
ItemRotationChange
ItemRotationHasChanged
ItemScaleChange
ItemScaleHasChanged
ItemSceneChange
ItemSceneHasChanged
ItemScenePositionHasChanged
ItemSelectedChange
ItemSelectedHasChanged
ItemSendsGeometryChanges
ItemSendsScenePositionChanges
ItemStacksBehindParent
ItemToolTipChange
ItemToolTipHasChanged
ItemTransformChange
ItemTransformHasChanged
ItemTransformOriginPointChange
ItemTransformOriginPointHasChanged
ItemUsesExtendedStyleOption
ItemVisibleChange
ItemVisibleHasChanged
ItemWidth
ItemZValueChange
ItemZValueHasChanged
LegendColumnCount
LegendTitle
LowerLeft
LowerMiddle
LowerRight
MapAtlasMargin
MapLayers
MapRotation
MapScale
MapStylePreset
MapXMax
MapXMin
MapYMax
MapYMin
Middle
MiddleLeft
MiddleRight
NoCache
NoProperty
NonModal
NumPages
Opacity
OriginalValue
PageNumber
PanelModal
PaperHeight
PaperOrientation
PaperWidth
PictureSource
PictureSvgBackgroundColor
PictureSvgStrokeColor
PictureSvgStrokeWidth
PositionX
PositionY
PresetPaperSize
ScalebarFillColor
ScalebarFillColor2
ScalebarLineColor
ScalebarLineWidth
SceneModal
SourceUrl
Stretch
TestProperty
Transparency
TrueNorth
Type
UndoArrowHeadFillColor
UndoArrowHeadStrokeColor
UndoArrowHeadWidth
UndoArrowStrokeWidth
UndoAtlasMargin
UndoBackgroundColor
UndoCustomCommand
UndoGridFramePenColor
UndoIncrementalMove
UndoIncrementalResize
UndoLabelFont
UndoLabelFontColor
UndoLabelMargin
UndoLabelText
UndoLegendBoxSpace
UndoLegendColumnCount
UndoLegendColumnSpace
UndoLegendFontColor
UndoLegendGroupFont
UndoLegendGroupSpace
UndoLegendIconSymbolSpace
UndoLegendItemFont
UndoLegendLayerFont
UndoLegendLayerSpace
UndoLegendLineSpacing
UndoLegendRasterStrokeColor
UndoLegendRasterStrokeWidth
UndoLegendSymbolHeight
UndoLegendSymbolSpace
UndoLegendSymbolWidth
UndoLegendText
UndoLegendTitleFont
UndoLegendTitleSpaceBottom
UndoLegendWmsLegendHeight
UndoLegendWmsLegendWidth
UndoMapAnnotationDistance
UndoMapGridAnnotationFontColor
UndoMapGridFrameFill1Color
UndoMapGridFrameFill2Color
UndoMapGridLineSymbol
UndoMapGridMarkerSymbol
UndoMapRotation
UndoNodeMove
UndoNone
UndoOpacity
UndoOverviewStyle
UndoPictureFillColor
UndoPictureNorthOffset
UndoPictureRotation
UndoPictureStrokeColor
UndoPictureStrokeWidth
UndoRotation
UndoScaleBarBoxContentSpace
UndoScaleBarFillColor
UndoScaleBarFillColor2
UndoScaleBarFontColor
UndoScaleBarHeight
UndoScaleBarLabelBarSize
UndoScaleBarLineWidth
UndoScaleBarMapUnitsSegment
UndoScaleBarSegmentSize
UndoScaleBarSegments
UndoScaleBarSegmentsLeft
UndoScaleBarStrokeColor
UndoScaleBarUnitText
UndoSetId
UndoShapeCornerRadius
UndoShapeStyle
UndoStrokeColor
UndoStrokeWidth
UndoZoomContent
UpperLeft
UpperMiddle
UpperRight
UserType
Zoom
ZoomResizeFrame
changed
Emitted when the object’s properties change. destroyed
destroyed(self, QObject = None) [signal] frameChanged
Emitted if the item’s frame style changes. lockChanged
Emitted if the item’s lock status changes. objectNameChanged
objectNameChanged(self, str) [signal] pictureRotationChanged
Is emitted on picture rotation change [signal] rotationChanged
Emitted on item rotation change. sizePositionChanged
Emitted when the item’s size or position changes. staticMetaObject
-
Clip
= 2¶
-
class
Format
¶ Bases:
int
-
FormatRaster
= 1¶
-
FormatSVG
= 0¶
-
FormatUnknown
= 2¶
-
FrameToImageSize
= 4¶
-
GridNorth
= 0¶
-
class
NorthMode
¶ Bases:
int
-
class
ResizeMode
¶ Bases:
int
-
Stretch
= 1¶
-
TrueNorth
= 1¶
-
Zoom
= 0¶
-
ZoomResizeFrame
= 3¶
-
adjustPointForReferencePosition
()¶
-
applyDataDefinedSize
()¶
-
applyItemSizeConstraint
(self, targetSize: QSizeF) → QSizeF¶
-
childEvent
()¶
-
connectNotify
()¶
-
containsAdvancedEffects
(self) → bool¶
-
contextMenuEvent
()¶
-
create
(layout: QgsLayout) → QgsLayoutItemPicture¶ Returns a new picture item for the specified
layout
.The caller takes responsibility for deleting the returned object.
-
customEvent
()¶
-
disconnectNotify
()¶
-
dragEnterEvent
()¶
-
dragLeaveEvent
()¶
-
dragMoveEvent
()¶
-
draw
(self, context: QgsRenderContext, itemStyle: QStyleOptionGraphicsItem = None)¶
-
drawBackground
()¶
-
drawDebugRect
()¶
-
drawFrame
()¶
-
dropEvent
()¶
-
finalizeRestoreFromXml
(self)¶
-
focusInEvent
()¶
-
focusOutEvent
()¶
-
hoverEnterEvent
()¶
-
hoverLeaveEvent
()¶
-
hoverMoveEvent
()¶
-
icon
(self) → QIcon¶
-
inputMethodEvent
()¶
-
inputMethodQuery
()¶
-
isSignalConnected
()¶
-
itemChange
()¶
-
keyPressEvent
()¶
-
keyReleaseEvent
()¶
-
linkedMap
(self) → QgsLayoutItemMap¶ Returns the linked rotation map, if set. An None means map rotation is disabled. If this is set then the picture is rotated by the same amount as the specified map object.
See also
-
mode
(self) → QgsLayoutItemPicture.Format¶ Returns the current picture mode (image format).
-
mouseDoubleClickEvent
()¶
-
mouseMoveEvent
()¶
-
mousePressEvent
()¶
-
mouseReleaseEvent
()¶
-
northMode
(self) → QgsLayoutItemPicture.NorthMode¶ Returns the mode used to align the picture to a map’s North.
See also
See also
-
northOffset
(self) → float¶ Returns the offset added to the picture’s rotation from a map’s North.
See also
See also
-
pictureAnchor
(self) → QgsLayoutItem.ReferencePoint¶ Returns the picture’s current anchor, which controls how it is placed within the picture item’s frame.
See also
-
picturePath
(self) → str¶ Returns the path of the source image. Data defined picture source may override this value. The path can either be a local path or a remote (http) path.
Returns: path for the source image See also
usePictureExpression()
See also
-
pictureRotation
(self) → float¶ Returns the rotation used for drawing the picture within the item’s frame, in degrees clockwise.
See also
See also
rotationMap()
-
pictureRotationChanged
¶ Is emitted on picture rotation change [signal]
-
positionAtReferencePoint
()¶
-
prepareGeometryChange
()¶
-
readObjectPropertiesFromElement
()¶
-
readPropertiesFromElement
(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) → bool¶
-
recalculateSize
(self)¶ Forces a recalculation of the picture’s frame size
-
receivers
()¶
-
refreshBackgroundColor
()¶
-
refreshBlendMode
()¶
-
refreshDataDefinedProperty
(self, property: QgsLayoutObject.DataDefinedProperty = QgsLayoutObject.AllProperties)¶
-
refreshFrame
()¶
-
refreshItemPosition
()¶
-
refreshItemRotation
()¶
-
refreshItemSize
()¶
-
refreshOpacity
()¶
-
refreshPicture
(self, context: QgsExpressionContext = None)¶ Recalculates the source image (if using an expression for picture’s source) and reloads and redraws the picture.
Parameters: context – expression context for evaluating data defined picture sources
-
resizeMode
(self) → QgsLayoutItemPicture.ResizeMode¶ Returns the resize mode used for drawing the picture within the composer item’s frame.
See also
-
sceneEvent
()¶
-
sceneEventFilter
()¶
-
sender
()¶
-
senderSignalIndex
()¶
-
setFixedSize
()¶
-
setLinkedMap
(self, map: QgsLayoutItemMap)¶ Sets the
map
object for rotation.If this is set then the picture will be rotated by the same amount as the specified map object. This is useful especially for syncing north arrows with a map item.
See also
See also
-
setMinimumSize
()¶
-
setNorthMode
(self, mode: QgsLayoutItemPicture.NorthMode)¶ Sets the
mode
used to align the picture to a map’s North.See also
See also
-
setNorthOffset
(self, offset: float)¶ Sets the
offset
added to the picture’s rotation from a map’s North.See also
See also
-
setPictureAnchor
(self, anchor: QgsLayoutItem.ReferencePoint)¶ Sets the picture’s
anchor
point, which controls how it is placed within the picture item’s frame.See also
-
setPicturePath
(self, path: str)¶ Sets the source
path
of the image (may be svg or a raster format). Data defined picture source may override this value. The path can either be a local path or a remote (http) path.See also
-
setPictureRotation
(self, rotation: float)¶ Sets the picture
rotation
within the item bounds, in degrees clockwise. This does not affect the item’s frame, only the way the picture is drawn within the item.See also
-
setResizeMode
(self, mode: QgsLayoutItemPicture.ResizeMode)¶ Sets the resize
mode
used for drawing the picture within the item bounds.Parameters: mode – ResizeMode to use for image file See also
-
setSvgFillColor
(self, color: Union[QColor, Qt.GlobalColor])¶ Sets the fill
color
used for parametrized SVG files.Note
This setting only has an effect on parametrized SVG files, and is ignored for non-parametrized SVG files.
See also
See also
-
setSvgStrokeColor
(self, color: Union[QColor, Qt.GlobalColor])¶ Sets the stroke
color
used for parametrized SVG files.Parameters: color – stroke color. Note
This setting only has an effect on parametrized SVG files, and is ignored for non-parametrized SVG files.
See also
svgStrokelColor()
See also
-
setSvgStrokeWidth
(self, width: float)¶ Sets the stroke
width
(in layout units) used for parametrized SVG files.Note
This setting only has an effect on parametrized SVG files, and is ignored for non-parametrized SVG files.
See also
See also
-
svgFillColor
(self) → QColor¶ Returns the fill color used for parametrized SVG files.
See also
See also
-
svgStrokeColor
(self) → QColor¶ Returns the stroke color used for parametrized SVG files.
See also
See also
-
svgStrokeWidth
(self) → float¶ Returns the stroke width (in layout units) used for parametrized SVG files.
See also
See also
-
timerEvent
()¶
-
topLeftToReferencePoint
()¶
-
type
(self) → int¶
-
updateMicroFocus
()¶
-
wheelEvent
()¶
-
writeObjectPropertiesToElement
()¶
-
writePropertiesToElement
(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) → bool¶
-