Class: QgsLayoutItemPicture¶
-
class
qgis.core.
QgsLayoutItemPicture
(layout: QgsLayout)¶ Bases:
qgis._core.QgsLayoutItem
Constructor for QgsLayoutItemPicture, with the specified parent
layout
.A layout item subclass that displays SVG files or raster format images (jpg, png, …).
New in version 3.0: Enums
Methods
Returns a new picture item for the specified
layout
.Returns the current evaluated picture path, which includes the result of data defined path overrides.
Returns true if the source image is missing and the picture cannot be rendered.
Returns the linked rotation map, if set.
Returns the current picture mode (image format).
Returns the mode used to align the picture to a map’s North.
Returns the offset added to the picture’s rotation from a map’s North.
Returns the picture’s current anchor, which controls how it is placed within the picture item’s frame.
Returns the path of the source image.
Returns the rotation used for drawing the picture within the item’s frame, in degrees clockwise.
Forces a recalculation of the picture’s frame size
Recalculates the source image (if using an expression for picture’s source) and reloads and redraws the picture.
Returns the resize mode used for drawing the picture within the composer item’s frame.
Sets the
map
object for rotation.Sets the
mode
used to align the picture to a map’s North.Sets the
offset
added to the picture’s rotation from a map’s North.Sets the picture’s
anchor
point, which controls how it is placed within the picture item’s frame.Sets the source
path
of the image (may be svg or a raster format).Sets the picture
rotation
within the item bounds, in degrees clockwise.Sets the resize
mode
used for drawing the picture within the item bounds.Sets the fill
color
used for parametrized SVG files.Sets the stroke
color
used for parametrized SVG files.Sets the stroke
width
(in layout units) used for parametrized SVG files.Returns the fill color used for parametrized SVG files.
Returns the stroke color used for parametrized SVG files.
Returns the stroke width (in layout units) used for parametrized SVG files.
Signals
Is emitted on picture rotation change [signal]
Attributes
-
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
()¶
-
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: QgsLayoutItemRenderContext)¶
-
drawBackground
()¶
-
drawDebugRect
()¶
-
drawFrame
()¶
-
dropEvent
()¶
-
evaluatedPath
(self) → str¶ Returns the current evaluated picture path, which includes the result of data defined path overrides.
See also
New in version 3.6.
-
finalizeRestoreFromXml
(self)¶
-
focusInEvent
()¶
-
focusOutEvent
()¶
-
hoverEnterEvent
()¶
-
hoverLeaveEvent
()¶
-
hoverMoveEvent
()¶
-
icon
(self) → QIcon¶
-
inputMethodEvent
()¶
-
inputMethodQuery
()¶
-
isMissingImage
(self) → bool¶ Returns true if the source image is missing and the picture cannot be rendered.
New in version 3.6.
-
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
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
-
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
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¶
-