Class: QgsLayoutFrame¶
- class qgis.core.QgsLayoutFrame¶
Bases:
QgsLayoutItem
Base class for frame items, which form a layout multiframe item.
New in version 3.0.
QgsLayoutFrame(layout:
QgsLayout
, multiFrame:QgsLayoutMultiFrame
) Constructor forQgsLayoutFrame
, with the specified parentlayout
and belonging to amultiFrame
.Methods
Adjusts the specified
point
at which areference
position of the item sits and returns the top left corner of the item, if reference point were placed at the specified position.Applies any present data defined size overrides to the specified layout
size
.Applies any item-specific size constraint handling to a given
targetSize
in layout units.Creates a new
QgsLayoutFrame
belonging to the specifiedlayout
.- rtype
QgsExpressionContext
- rtype
str
- param context
- param context
Draws a debugging rectangle of the item's current bounds within the specified painter.
- param context
- rtype
QgsLayoutItem.ExportLayerBehavior
Returns the visible portion of the multi frame's content which is shown in this frame, in layout units.
- rtype
QgsLayoutSize
Returns the path to use when drawing the item's frame or background.
Returns whether the background and frame stroke should be hidden if this frame is empty
Returns whether the page should be hidden (ie, not included in layout exports) if this frame is empty
- rtype
QIcon
Returns whether the frame is empty.
- rtype
QgsLayoutSize
Returns the parent multiframe for the frame.
Returns the current position (in layout units) of a
reference
point for the item.Sets object properties from a DOM element
- param itemElement
Refresh item's background color, considering data defined colors.
Refresh item's blend mode, considering data defined blend mode.
Refresh item's frame, considering data defined colors and frame size.
Refreshes an item's position by rechecking it against any possible overrides such as data defined positioning.
Refreshes an item's rotation by rechecking it against any possible overrides such as data defined rotation.
Refreshes an item's size by rechecking it against any possible item fixed or minimum sizes.
Refresh item's opacity, considering data defined opacity.
Sets the visible part of the multiframe's content which is visible within this frame (relative to the total multiframe extent in layout units).
Sets a fixed
size
for the layout item, which prevents it from being freely resized.Sets whether the background and frame stroke should be hidden if this frame is empty
Sets whether the page should be hidden (ie, not included in layout exports) if this frame is empty
Sets the minimum allowed
size
for the layout item.Returns the position for the reference point of the item, if the top-left of the item was placed at the specified
point
.- rtype
int
Stores object properties within an XML DOM element.
- param parentElement
- adjustPointForReferencePosition(self, point: Union[QPointF, QPoint], size: QSizeF, reference: QgsLayoutItem.ReferencePoint) QPointF ¶
Adjusts the specified
point
at which areference
position of the item sits and returns the top left corner of the item, if reference point were placed at the specified position.
- applyDataDefinedSize(self, size: QgsLayoutSize) QgsLayoutSize ¶
Applies any present data defined size overrides to the specified layout
size
.
- applyItemSizeConstraint(self, targetSize: QSizeF) QSizeF ¶
Applies any item-specific size constraint handling to a given
targetSize
in layout units. Subclasses can override this method if they need to apply advanced logic regarding item sizes, which cannot be covered bysetFixedSize()
orsetMinimumSize()
. Item size constraints are applied after fixed, minimum and data defined size constraints.See also
See also
- childEvent(self, QChildEvent)¶
- cleanup(self)¶
- connectNotify(self, QMetaMethod)¶
- contextMenuEvent(self, QGraphicsSceneContextMenuEvent)¶
- create(layout: QgsLayout) QgsLayoutFrame ¶
Creates a new
QgsLayoutFrame
belonging to the specifiedlayout
.- Parameters
layout (QgsLayout) –
- Return type
- createExpressionContext(self) QgsExpressionContext ¶
- Return type
- customEvent(self, QEvent)¶
- disconnectNotify(self, QMetaMethod)¶
- displayName(self) str ¶
- Return type
str
- dragEnterEvent(self, QGraphicsSceneDragDropEvent)¶
- dragLeaveEvent(self, QGraphicsSceneDragDropEvent)¶
- dragMoveEvent(self, QGraphicsSceneDragDropEvent)¶
- draw(self, context: QgsLayoutItemRenderContext)¶
- Parameters
context (QgsLayoutItemRenderContext) –
- drawBackground(self, context: QgsRenderContext)¶
- Parameters
context (QgsRenderContext) –
- drawDebugRect(self, painter: QPainter)¶
Draws a debugging rectangle of the item’s current bounds within the specified painter.
- Parameters
painter – destination QPainter
- drawFrame(self, context: QgsRenderContext)¶
- Parameters
context (QgsRenderContext) –
- dropEvent(self, QGraphicsSceneDragDropEvent)¶
- exportLayerBehavior(self) QgsLayoutItem.ExportLayerBehavior ¶
- Return type
- extent(self) QRectF ¶
Returns the visible portion of the multi frame’s content which is shown in this frame, in layout units.
See also
- Return type
QRectF
- fixedSize(self) QgsLayoutSize ¶
- Return type
- focusInEvent(self, QFocusEvent)¶
- focusOutEvent(self, QFocusEvent)¶
- framePath(self) QPainterPath ¶
Returns the path to use when drawing the item’s frame or background.
See also
See also
New in version 3.16.
- hideBackgroundIfEmpty(self) bool ¶
Returns whether the background and frame stroke should be hidden if this frame is empty
- Return type
bool
- Returns
True
if background and stroke should be hidden if frame is empty
See also
- hidePageIfEmpty(self) bool ¶
Returns whether the page should be hidden (ie, not included in layout exports) if this frame is empty
- Return type
bool
- Returns
True
if page should be hidden if frame is empty
See also
- hoverEnterEvent(self, QGraphicsSceneHoverEvent)¶
- hoverLeaveEvent(self, QGraphicsSceneHoverEvent)¶
- hoverMoveEvent(self, QGraphicsSceneHoverEvent)¶
- icon(self) QIcon ¶
- Return type
QIcon
- inputMethodEvent(self, QInputMethodEvent)¶
- inputMethodQuery(self, Qt.InputMethodQuery) Any ¶
- isEmpty(self) bool ¶
Returns whether the frame is empty.
See also
- Return type
bool
- isSignalConnected(self, QMetaMethod) bool ¶
- itemChange(self, QGraphicsItem.GraphicsItemChange, Any) Any ¶
- keyPressEvent(self, QKeyEvent)¶
- keyReleaseEvent(self, QKeyEvent)¶
- minimumSize(self) QgsLayoutSize ¶
- Return type
- mouseDoubleClickEvent(self, QGraphicsSceneMouseEvent)¶
- mouseMoveEvent(self, QGraphicsSceneMouseEvent)¶
- mousePressEvent(self, QGraphicsSceneMouseEvent)¶
- mouseReleaseEvent(self, QGraphicsSceneMouseEvent)¶
- multiFrame(self) QgsLayoutMultiFrame ¶
Returns the parent multiframe for the frame.
- Return type
- positionAtReferencePoint(self, reference: QgsLayoutItem.ReferencePoint) QPointF ¶
Returns the current position (in layout units) of a
reference
point for the item.
- prepareGeometryChange(self)¶
- readObjectPropertiesFromElement(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
Sets object properties from a DOM element
- Parameters
parentElement – is the parent DOM element for the object
document – DOM document
context – read write context
- Returns
True
if read was successful
See also
- readPropertiesFromElement(self, itemElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
- Parameters
itemElement (QDomElement) –
document (QDomDocument) –
context (QgsReadWriteContext) –
- Return type
bool
- receivers(self, PYQT_SIGNAL) int ¶
- refreshBackgroundColor(self, updateItem: bool = True)¶
Refresh item’s background color, considering data defined colors. If
updateItem
is set toFalse
, the item will not be automatically updated after the frame color is set and a later call toupdate()
must be made.
- refreshBlendMode(self)¶
Refresh item’s blend mode, considering data defined blend mode.
- refreshFrame(self, updateItem: bool = True)¶
Refresh item’s frame, considering data defined colors and frame size. If
updateItem
is set toFalse
, the item will not be automatically updated after the frame is set and a later call toupdate()
must be made.
- refreshItemPosition(self)¶
Refreshes an item’s position by rechecking it against any possible overrides such as data defined positioning.
See also
- refreshItemRotation(self, origin: Union[QPointF, QPoint] = None)¶
Refreshes an item’s rotation by rechecking it against any possible overrides such as data defined rotation.
The optional
origin
point specifies the origin (in item coordinates) around which the rotation should be applied.See also
See also
- refreshItemSize(self)¶
Refreshes an item’s size by rechecking it against any possible item fixed or minimum sizes.
See also
See also
See also
- refreshOpacity(self, updateItem: bool = True)¶
Refresh item’s opacity, considering data defined opacity. If
updateItem
is set toFalse
the item will not be automatically updated after the opacity is set and a later call toupdate()
must be made.
- sceneEvent(self, QEvent) bool ¶
- sceneEventFilter(self, QGraphicsItem, QEvent) bool ¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setContentSection(self, section: QRectF)¶
Sets the visible part of the multiframe’s content which is visible within this frame (relative to the total multiframe extent in layout units).
See also
- Parameters
section (QRectF) –
- setFixedSize(self, size: QgsLayoutSize)¶
Sets a fixed
size
for the layout item, which prevents it from being freely resized. Set an empty size if item can be freely resized.See also
See also
- setHideBackgroundIfEmpty(self, hideBackgroundIfEmpty: bool)¶
Sets whether the background and frame stroke should be hidden if this frame is empty
- Parameters
hideBackgroundIfEmpty (bool) – set to
True
if background and stroke should be hidden if frame is empty
See also
- setHidePageIfEmpty(self, hidePageIfEmpty: bool)¶
Sets whether the page should be hidden (ie, not included in layout exports) if this frame is empty
- Parameters
hidePageIfEmpty (bool) – set to
True
if page should be hidden if frame is empty
See also
- setMinimumSize(self, size: QgsLayoutSize)¶
Sets the minimum allowed
size
for the layout item. Set an empty size if item can be freely resized.See also
See also
- timerEvent(self, QTimerEvent)¶
- topLeftToReferencePoint(self, point: QgsLayoutPoint) QgsLayoutPoint ¶
Returns the position for the reference point of the item, if the top-left of the item was placed at the specified
point
.
- type(self) int ¶
- Return type
int
- updateMicroFocus(self)¶
- wheelEvent(self, QGraphicsSceneWheelEvent)¶
- writeObjectPropertiesToElement(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
Stores object properties within an XML DOM element.
- Parameters
parentElement – is the parent DOM element to store the object’s properties in
document – DOM document
context – read write context
- Returns
True
if write was successful
See also
- writePropertiesToElement(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
- Parameters
parentElement (QDomElement) –
document (QDomDocument) –
context (QgsReadWriteContext) –
- Return type
bool