QGIS API Documentation  3.20.0-Odense (decaadbb31)
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
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:51