QgsLayoutGuide class

Contains the configuration for a single snap guide used by a layout.

Constructors, destructors, conversion operators

QgsLayoutGuide(Qt::Orientation orientation, QgsLayoutMeasurement position, QgsLayoutItemPage* page)
Constructor for a new guide with the specified orientation and initial position.

Public functions

auto item() -> QGraphicsLineItem*
Returns the guide's line item.
auto layout() const -> QgsLayout*
Returns the layout the guide belongs to.
auto layoutPosition() const -> double
Returns the guide's position in absolute layout units.
auto orientation() const -> Qt::Orientation
Returns the guide's orientation.
auto page() -> QgsLayoutItemPage*
Returns the page the guide is contained within.
auto position() const -> QgsLayoutMeasurement
Returns the guide's position within the page.
void setLayout(QgsLayout* layout)
Sets the layout the guide belongs to.
void setLayoutPosition(double position)
Sets the guide's position in absolute layout units.
void setPage(QgsLayoutItemPage* page)
Sets the page the guide is contained within.
void setPosition(QgsLayoutMeasurement position)
Sets the guide's position within the page.
void update()
Updates the position of the guide's line item.

Signals

void positionChanged()
Emitted when the guide's position is changed.

Function documentation

QgsLayoutGuide::QgsLayoutGuide(Qt::Orientation orientation, QgsLayoutMeasurement position, QgsLayoutItemPage* page)

Constructor for a new guide with the specified orientation and initial position.

A layout must be set by calling setLayout() before the guide can be used. Adding the guide to a QgsLayoutGuideCollection will automatically set the corresponding layout for you.

QgsLayout* QgsLayoutGuide::layout() const

Returns the layout the guide belongs to.

double QgsLayoutGuide::layoutPosition() const

Returns the guide's position in absolute layout units.

QgsLayoutItemPage* QgsLayoutGuide::page()

Returns the page the guide is contained within.

QgsLayoutMeasurement QgsLayoutGuide::position() const

Returns the guide's position within the page.

The position indicates either the horizontal or vertical position of the guide, depending on the guide's orientation().

void QgsLayoutGuide::setLayout(QgsLayout* layout)

Sets the layout the guide belongs to.

void QgsLayoutGuide::setLayoutPosition(double position)

Sets the guide's position in absolute layout units.

void QgsLayoutGuide::setPage(QgsLayoutItemPage* page)

Sets the page the guide is contained within.

void QgsLayoutGuide::setPosition(QgsLayoutMeasurement position)

Sets the guide's position within the page.

The position argument indicates either the horizontal or vertical position of the guide, depending on the guide's orientation().