Class: QgsLayoutGuideCollection¶
- class qgis.core.QgsLayoutGuideCollection¶
Bases:
PyQt5.QtCore.QAbstractTableModel
,QgsLayoutSerializableObject
Stores and manages the snap guides used by a layout.
Added in version 3.0.
QgsLayoutGuideCollection(layout: Optional[QgsLayout], pageCollection: Optional[QgsLayoutPageCollection]) Constructor for
QgsLayoutGuideCollection
belonging to the specified layout, and linked to the specifiedpageCollection
.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.
- param a0:
- param index:
- param index:
Returns a list of all guides contained in the collection.
Returns the list of guides contained on a matching
page
.- param section:
- rtype:
Optional[QgsLayout]
Sets the collection's state from a DOM element.
Removes the specified
guide
, and deletes it.- param row:
- param a0:
- param index:
Sets the absolute
position
(in layout coordinates) forguide
within the layout.Sets whether the guide lines should be
visible
.- rtype:
str
Updates the position (and visibility) of all guide line items.
Returns
True
if the guide lines should be drawn.Stores the collection's state in a DOM element.
Signals
Attributes
- LayoutPositionRole = 260¶
- OrientationRole = 256¶
- PageRole = 259¶
- PositionRole = 257¶
- class Roles¶
Bases:
int
- UnitsRole = 258¶
- addGuide(self, guide: QgsLayoutGuide | None)¶
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)¶
Resets all other pages’ guides to match the guides from the specified
sourcePage
.- Parameters:
sourcePage (int)
- beginInsertColumns(self, parent: QModelIndex, first: int, last: int)¶
- beginInsertRows(self, parent: QModelIndex, first: int, last: int)¶
- beginMoveColumns(self, sourceParent: QModelIndex, sourceFirst: int, sourceLast: int, destinationParent: QModelIndex, destinationColumn: int) bool ¶
- beginMoveRows(self, sourceParent: QModelIndex, sourceFirst: int, sourceLast: int, destinationParent: QModelIndex, destinationRow: int) bool ¶
- beginRemoveColumns(self, parent: QModelIndex, first: int, last: int)¶
- beginRemoveRows(self, parent: QModelIndex, first: int, last: int)¶
- beginResetModel(self)¶
- changePersistentIndex(self, from_: QModelIndex, to: QModelIndex)¶
- changePersistentIndexList(self, from_: Iterable[QModelIndex], to: Iterable[QModelIndex])¶
- childEvent(self, a0: QChildEvent | None)¶
- clear(self)¶
Removes all guides from the collection.
See also
- columnCount(self, a0: QModelIndex) int ¶
- Parameters:
a0 (QModelIndex)
- Return type:
int
- connectNotify(self, signal: QMetaMethod)¶
- createIndex(self, row: int, column: int, object: Any = None) QModelIndex ¶
- customEvent(self, a0: QEvent | None)¶
- data(self, index: QModelIndex, role: int) Any ¶
- Parameters:
index (QModelIndex)
role (int)
- Return type:
Any
- decodeData(self, row: int, column: int, parent: QModelIndex, stream: QDataStream) bool ¶
- disconnectNotify(self, signal: QMetaMethod)¶
- encodeData(self, indexes: Iterable[QModelIndex], stream: QDataStream)¶
- endInsertColumns(self)¶
- endInsertRows(self)¶
- endMoveColumns(self)¶
- endMoveRows(self)¶
- endRemoveColumns(self)¶
- endRemoveRows(self)¶
- endResetModel(self)¶
- flags(self, index: QModelIndex) Qt.ItemFlags ¶
- Parameters:
index (QModelIndex)
- Return type:
Qt.ItemFlags
- guides(self) List[QgsLayoutGuide] ¶
Returns a list of all guides contained in the collection.
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
- 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]
- headerData(self, section: int, orientation: Qt.Orientation, role: int = Qt.DisplayRole) Any ¶
- Parameters:
section (int)
orientation (Qt.Orientation)
role (int = Qt.DisplayRole)
- Return type:
Any
- isSignalConnected(self, signal: QMetaMethod) bool ¶
- persistentIndexList(self) List[QModelIndex] ¶
- readXml(self, collectionElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
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
- receivers(self, signal: PYQT_SIGNAL) int ¶
- removeGuide(self, guide: QgsLayoutGuide | None)¶
Removes the specified
guide
, and deletes it.See also
- Parameters:
guide (Optional[QgsLayoutGuide])
- removeRows(self, row: int, count: int, parent: QModelIndex = QModelIndex()) bool ¶
- Parameters:
row (int)
count (int)
parent (QModelIndex = QModelIndex())
- Return type:
bool
- resetInternalData(self)¶
- rowCount(self, a0: QModelIndex) int ¶
- Parameters:
a0 (QModelIndex)
- Return type:
int
- sender(self) QObject | None ¶
- senderSignalIndex(self) int ¶
- setData(self, index: QModelIndex, value: Any, role: int) bool ¶
- Parameters:
index (QModelIndex)
value (Any)
role (int)
- Return type:
bool
- setGuideLayoutPosition(self, guide: QgsLayoutGuide | None, position: float)¶
Sets the absolute
position
(in layout coordinates) forguide
within the layout.- Parameters:
guide (Optional[QgsLayoutGuide])
position (float)
- setVisible(self, visible: bool)¶
Sets whether the guide lines should be
visible
.See also
- Parameters:
visible (bool)
- stringType(self) str ¶
- Return type:
str
- timerEvent(self, a0: QTimerEvent | None)¶
- update(self)¶
Updates the position (and visibility) of all guide line items.
- visible(self) bool ¶
Returns
True
if the guide lines should be drawn.See also
- Return type:
bool
- writeXml(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
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