QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
qgslayoutaligner.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutaligner.h
3 ------------------
4 begin : October 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16#ifndef QGSLAYOUTALIGNER_H
17#define QGSLAYOUTALIGNER_H
18
19#include "qgis_core.h"
20#include <QList>
21#include <QRectF>
22
23class QgsLayoutItem;
24class QgsLayout;
25
35class CORE_EXPORT QgsLayoutAligner
36{
37
38 public:
39
42 {
49 };
50
53 {
62 };
63
65 enum Resize
66 {
72 };
73
79 static void alignItems( QgsLayout *layout, const QList< QgsLayoutItem * > &items, Alignment alignment );
80
86 static void distributeItems( QgsLayout *layout, const QList< QgsLayoutItem * > &items, Distribution distribution );
87
93 static void resizeItems( QgsLayout *layout, const QList< QgsLayoutItem * > &items, Resize resize );
94
95 private:
96
101 static QRectF boundingRectOfItems( const QList< QgsLayoutItem * > &items );
102
103 static QString undoText( Alignment alignment );
104 static QString undoText( Distribution distribution );
105 static QString undoText( Resize resize );
106
113 static void distributeEquispacedItems( QgsLayout *layout, const QList<QgsLayoutItem *> &items, QgsLayoutAligner::Distribution distribution );
114
115
116};
117
118#endif //QGSLAYOUTALIGNER_H
Handles aligning and distributing sets of layout items.
Alignment
Alignment options.
@ AlignVCenter
Align vertical centers.
@ AlignLeft
Align left edges.
@ AlignBottom
Align bottom edges.
@ AlignRight
Align right edges.
@ AlignTop
Align top edges.
@ AlignHCenter
Align horizontal centers.
Resize
Resize options.
@ ResizeNarrowest
Resize width to match narrowest width.
@ ResizeShortest
Resize height to match shortest height.
@ ResizeTallest
Resize height to match tallest height.
@ ResizeToSquare
Resize items to square.
@ ResizeWidest
Resize width to match widest width.
Distribution
Distribution options.
@ DistributeHSpace
Distribute horizontal equispaced.
@ DistributeVCenter
Distribute vertical centers.
@ DistributeBottom
Distribute bottom edges.
@ DistributeLeft
Distribute left edges.
@ DistributeHCenter
Distribute horizontal centers.
@ DistributeRight
Distribute right edges.
@ DistributeVSpace
Distribute vertical equispaced.
@ DistributeTop
Distribute top edges.
Base class for graphical items within a QgsLayout.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:49