Class: QgsLayoutGuideCollection¶
Stores and manages the snap guides used by a layout.
Class Hierarchy¶
Base classes¶
An interface for layout objects which can be stored and read from DOM elements. |
|
Interface for layout objects which support undo/redo commands. |
Enums
Custom model roles. |
|
alias of |
Abstract Methods
Sets the collection's state from a DOM element. |
|
Stores the collection's state in a DOM element. |
Methods
Adds a guide to the collection. |
|
Resets all other pages' guides to match the guides from the specified sourcePage. |
|
Removes all guides from the collection. |
|
Returns a list of all guides contained in the collection. |
|
Returns the list of guides contained on a matching page. |
|
Removes the specified guide, and deletes it. |
|
Sets the absolute position (in layout coordinates) for guide within the layout. |
|
Sets whether the guide lines should be visible. |
|
Updates the position (and visibility) of all guide line items. |
|
Returns |
- class qgis.core.QgsLayoutGuideCollection[source]¶
Bases:
QAbstractTableModel
,QgsLayoutSerializableObject
- __init__(layout: QgsLayout | None, pageCollection: QgsLayoutPageCollection | None)
Constructor for QgsLayoutGuideCollection belonging to the specified layout, and linked to the specified
pageCollection
.- Parameters:
layout (Optional[QgsLayout])
pageCollection (Optional[QgsLayoutPageCollection])
- class CustomRole(*values)¶
Bases:
IntEnum
Custom model roles.
Note
Prior to QGIS 3.36 this was available as QgsLayoutGuideCollection.Roles
Added in version 3.36.
Orientation
: Guide orientation roleAvailable as
QgsLayoutGuideCollection.OrientationRole
in older QGIS releases.Position
: Guide position roleAvailable as
QgsLayoutGuideCollection.PositionRole
in older QGIS releases.Units
: Guide position units roleAvailable as
QgsLayoutGuideCollection.UnitsRole
in older QGIS releases.Page
: Guide page roleAvailable as
QgsLayoutGuideCollection.PageRole
in older QGIS releases.LayoutPosition
: Guide position in layout coordinatesAvailable as
QgsLayoutGuideCollection.LayoutPositionRole
in older QGIS releases.
- Roles¶
alias of
CustomRole
- addGuide(self, guide: QgsLayoutGuide | None)[source]¶
Adds a
guide
to the collection. Ownership of the guide is transferred to the collection, and the guide will automatically have the correct layout set.- Parameters:
guide (Optional[QgsLayoutGuide])
- applyGuidesToAllOtherPages(self, sourcePage: int)[source]¶
Resets all other pages’ guides to match the guides from the specified
sourcePage
.- Parameters:
sourcePage (int)
- guides(self) List[QgsLayoutGuide] ¶
Returns a list of all guides contained in the collection.
- Return type:
List[QgsLayoutGuide]
- guides(self, orientation: Qt.Orientation, page: int = -1) List[QgsLayoutGuide]
Returns the list of guides contained in the collection with the specified
orientation
and on a matchingpage
. Ifpage
is -1, guides from all pages will be returned.See also
- Parameters:
orientation (Qt.Orientation)
page (int = -1)
- Return type:
List[QgsLayoutGuide]
- guidesOnPage(self, page: int) List[QgsLayoutGuide] ¶
Returns the list of guides contained on a matching
page
.See also
- Parameters:
page (int)
- Return type:
List[QgsLayoutGuide]
- abstract readXml(self, collectionElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool [source]¶
Sets the collection’s state from a DOM element. collectionElement is the DOM node corresponding to the collection.
See also
- Parameters:
collectionElement (QDomElement)
document (QDomDocument)
context (QgsReadWriteContext)
- Return type:
bool
- removeGuide(self, guide: QgsLayoutGuide | None)[source]¶
Removes the specified
guide
, and deletes it.See also
- Parameters:
guide (Optional[QgsLayoutGuide])
- setGuideLayoutPosition(self, guide: QgsLayoutGuide | None, position: float)[source]¶
Sets the absolute
position
(in layout coordinates) forguide
within the layout.- Parameters:
guide (Optional[QgsLayoutGuide])
position (float)
- setVisible(self, visible: bool)[source]¶
Sets whether the guide lines should be
visible
.See also
- Parameters:
visible (bool)
- visible(self) bool [source]¶
Returns
True
if the guide lines should be drawn.See also
- Return type:
bool
- abstract writeXml(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool [source]¶
Stores the collection’s state in a DOM element. The
parentElement
should refer to the parent layout’s DOM element.See also
- Parameters:
parentElement (QDomElement)
document (QDomDocument)
context (QgsReadWriteContext)
- Return type:
bool