QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 
23 class QgsLayoutItem;
24 class QgsLayout;
25 
36 class CORE_EXPORT QgsLayoutAligner
37 {
38 
39  public:
40 
42  enum Alignment
43  {
50  };
51 
54  {
63  };
64 
66  enum Resize
67  {
73  };
74 
80  static void alignItems( QgsLayout *layout, const QList< QgsLayoutItem * > &items, Alignment alignment );
81 
87  static void distributeItems( QgsLayout *layout, const QList< QgsLayoutItem * > &items, Distribution distribution );
88 
94  static void resizeItems( QgsLayout *layout, const QList< QgsLayoutItem * > &items, Resize resize );
95 
96  private:
97 
102  static QRectF boundingRectOfItems( const QList< QgsLayoutItem * > &items );
103 
104  static QString undoText( Alignment alignment );
105  static QString undoText( Distribution distribution );
106  static QString undoText( Resize resize );
107 
114  static void distributeEquispacedItems( QgsLayout *layout, const QList<QgsLayoutItem *> &items, QgsLayoutAligner::Distribution distribution );
115 
116 
117 };
118 
119 #endif //QGSLAYOUTALIGNER_H
QgsLayoutAligner::AlignVCenter
@ AlignVCenter
Align vertical centers.
Definition: qgslayoutaligner.h:48
QgsLayoutAligner::DistributeLeft
@ DistributeLeft
Distribute left edges.
Definition: qgslayoutaligner.h:55
QgsLayoutAligner::ResizeWidest
@ ResizeWidest
Resize width to match widest width.
Definition: qgslayoutaligner.h:69
QgsLayoutAligner::DistributeTop
@ DistributeTop
Distribute top edges.
Definition: qgslayoutaligner.h:59
QgsLayoutAligner::AlignLeft
@ AlignLeft
Align left edges.
Definition: qgslayoutaligner.h:44
QgsLayoutAligner::DistributeHSpace
@ DistributeHSpace
Distribute horizontal equispaced.
Definition: qgslayoutaligner.h:57
QgsLayoutAligner::AlignBottom
@ AlignBottom
Align bottom edges.
Definition: qgslayoutaligner.h:49
QgsLayoutAligner::DistributeHCenter
@ DistributeHCenter
Distribute horizontal centers.
Definition: qgslayoutaligner.h:56
QgsLayoutAligner::AlignTop
@ AlignTop
Align top edges.
Definition: qgslayoutaligner.h:47
QgsLayoutAligner::ResizeTallest
@ ResizeTallest
Resize height to match tallest height.
Definition: qgslayoutaligner.h:71
QgsLayoutAligner::ResizeShortest
@ ResizeShortest
Resize height to match shortest height.
Definition: qgslayoutaligner.h:70
QgsLayoutAligner::DistributeBottom
@ DistributeBottom
Distribute bottom edges.
Definition: qgslayoutaligner.h:62
QgsLayoutItem
Base class for graphical items within a QgsLayout.
Definition: qgslayoutitem.h:113
QgsLayoutAligner::Alignment
Alignment
Alignment options.
Definition: qgslayoutaligner.h:43
QgsLayoutAligner::ResizeToSquare
@ ResizeToSquare
Resize items to square.
Definition: qgslayoutaligner.h:72
QgsLayoutAligner::Distribution
Distribution
Distribution options.
Definition: qgslayoutaligner.h:54
QgsLayoutAligner::DistributeVSpace
@ DistributeVSpace
Distribute vertical equispaced.
Definition: qgslayoutaligner.h:61
QgsLayoutAligner
Handles aligning and distributing sets of layout items.
Definition: qgslayoutaligner.h:37
QgsLayoutAligner::Resize
Resize
Resize options.
Definition: qgslayoutaligner.h:67
QgsLayout
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:50
QgsLayoutAligner::AlignRight
@ AlignRight
Align right edges.
Definition: qgslayoutaligner.h:46
QgsLayoutAligner::DistributeVCenter
@ DistributeVCenter
Distribute vertical centers.
Definition: qgslayoutaligner.h:60
QgsLayoutAligner::AlignHCenter
@ AlignHCenter
Align horizontal centers.
Definition: qgslayoutaligner.h:45
QgsLayoutAligner::DistributeRight
@ DistributeRight
Distribute right edges.
Definition: qgslayoutaligner.h:58
QgsLayoutAligner::ResizeNarrowest
@ ResizeNarrowest
Resize width to match narrowest width.
Definition: qgslayoutaligner.h:68