QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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.
Base class for graphical items within a QgsLayout.
Align vertical centers.
Resize items to square.
Distribute horizontal equispaced.
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 vertical equispaced.
Distribute horizontal centers.
Resize
Resize options.
Distribute bottom edges.
Resize width to match narrowest width.