QgsLayoutAligner class

Handles aligning and distributing sets of layout items.

QgsLayoutAligner contains methods for automatically aligning and distributing sets of layout items, e.g. aligning a group of items to top or left sides.

Public types

enum Alignment { AlignLeft, AlignHCenter, AlignRight, AlignTop, AlignVCenter, AlignBottom }
Alignment options.
enum Distribution { DistributeLeft, DistributeHCenter, DistributeRight, DistributeTop, DistributeVCenter, DistributeBottom }
Distribution options.
enum Resize { ResizeNarrowest, ResizeWidest, ResizeShortest, ResizeTallest, ResizeToSquare }
Resize options.

Public static functions

static void alignItems(QgsLayout* layout, const QList<QgsLayoutItem*>& items, Alignment alignment)
Aligns a set of items from a layout in place.
static void distributeItems(QgsLayout* layout, const QList<QgsLayoutItem*>& items, Distribution distribution)
Distributes a set of items from a layout in place.
static void resizeItems(QgsLayout* layout, const QList<QgsLayoutItem*>& items, Resize resize)
Resizes a set of items from a layout in place.

Enum documentation

enum QgsLayoutAligner::Alignment

Alignment options.

Enumerators
AlignLeft

Align left edges.

AlignHCenter

Align horizontal centers.

AlignRight

Align right edges.

AlignTop

Align top edges.

AlignVCenter

Align vertical centers.

AlignBottom

Align bottom edges.

enum QgsLayoutAligner::Distribution

Distribution options.

Enumerators
DistributeLeft

Distribute left edges.

DistributeHCenter

Distribute horizontal centers.

DistributeRight

Distribute right edges.

DistributeTop

Distribute top edges.

DistributeVCenter

Distribute vertical centers.

DistributeBottom

Distribute bottom edges.

enum QgsLayoutAligner::Resize

Resize options.

Enumerators
ResizeNarrowest

Resize width to match narrowest width.

ResizeWidest

Resize width to match widest width.

ResizeShortest

Resize height to match shortest height.

ResizeTallest

Resize height to match tallest height.

ResizeToSquare

Resize items to square.

Function documentation

static void QgsLayoutAligner::alignItems(QgsLayout* layout, const QList<QgsLayoutItem*>& items, Alignment alignment)

Aligns a set of items from a layout in place.

The alignment argument specifies the method to use when aligning the items.

static void QgsLayoutAligner::distributeItems(QgsLayout* layout, const QList<QgsLayoutItem*>& items, Distribution distribution)

Distributes a set of items from a layout in place.

The distribution argument specifies the method to use when distributing the items.

static void QgsLayoutAligner::resizeItems(QgsLayout* layout, const QList<QgsLayoutItem*>& items, Resize resize)

Resizes a set of items from a layout in place.

The resize argument specifies the method to use when resizing the items.