QGIS API Documentation  3.6.0-Noosa (5873452)
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  {
61  };
62 
64  enum Resize
65  {
71  };
72 
78  static void alignItems( QgsLayout *layout, const QList< QgsLayoutItem * > &items, Alignment alignment );
79 
85  static void distributeItems( QgsLayout *layout, const QList< QgsLayoutItem * > &items, Distribution distribution );
86 
92  static void resizeItems( QgsLayout *layout, const QList< QgsLayoutItem * > &items, Resize resize );
93 
94  private:
95 
100  static QRectF boundingRectOfItems( const QList< QgsLayoutItem * > &items );
101 
102  static QString undoText( Alignment alignment );
103  static QString undoText( Distribution distribution );
104  static QString undoText( Resize resize );
105 
106 
107 
108 };
109 
110 #endif //QGSLAYOUTALIGNER_H
Handles aligning and distributing sets of layout items.
Base class for graphical items within a QgsLayout.
Align vertical centers.
Resize items to square.
Resize height to match shortest height.
Distribute vertical centers.
Distribution
Distribution options.
Resize height to match tallest height.
Distribute right edges.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:49
Resize width to match widest width.
Align horizontal centers.
Alignment
Alignment options.
Distribute horizontal centers.
Resize
Resize options.
Distribute bottom edges.
Resize width to match narrowest width.