QGIS API Documentation  3.6.0-Noosa (5873452)
qgslayouttablecolumn.h
Go to the documentation of this file.
1 /***************************************************************************
2  QgsLayoutTableColumn.h
3  ------------------
4  begin : November 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSLAYOUTTABLECOLUMN_H
19 #define QGSLAYOUTTABLECOLUMN_H
20 
21 #include <QObject>
22 #include <QDomDocument>
23 #include <QDomElement>
24 #include <QColor>
25 
26 #include "qgis_core.h"
27 #include "qgis_sip.h"
28 
36 class CORE_EXPORT QgsLayoutTableColumn : public QObject
37 {
38  Q_OBJECT
39 
40  public:
41 
46  QgsLayoutTableColumn( const QString &heading = QString() );
47 
54  bool writeXml( QDomElement &columnElem, QDomDocument &doc ) const;
55 
61  bool readXml( const QDomElement &columnElem );
62 
68  double width() const { return mWidth; }
69 
74  void setWidth( const double width ) { mWidth = width; }
75 
81  QString heading() const { return mHeading; }
82 
88  void setHeading( const QString &heading ) { mHeading = heading; }
89 
96  Qt::AlignmentFlag hAlignment() const { return mHAlignment; }
97 
104  void setHAlignment( Qt::AlignmentFlag alignment ) { mHAlignment = alignment; }
105 
112  Qt::AlignmentFlag vAlignment() const { return mVAlignment; }
113 
120  void setVAlignment( Qt::AlignmentFlag alignment ) { mVAlignment = alignment; }
121 
128  QString attribute() const { return mAttribute; }
129 
136  void setAttribute( const QString &attribute ) { mAttribute = attribute; }
137 
145  Qt::SortOrder sortOrder() const { return mSortOrder; }
146 
154  void setSortOrder( Qt::SortOrder order ) { mSortOrder = order; }
155 
169  int sortByRank() const { return mSortByRank; }
170 
183  void setSortByRank( int rank ) { mSortByRank = rank; }
184 
190 
191  private:
192 
193  QColor mBackgroundColor = Qt::transparent; //currently unused
194  Qt::AlignmentFlag mHAlignment = Qt::AlignLeft;
195  Qt::AlignmentFlag mVAlignment = Qt::AlignVCenter;
196  QString mHeading;
197  QString mAttribute;
198  int mSortByRank = 0;
199  Qt::SortOrder mSortOrder = Qt::AscendingOrder;
200  double mWidth = 0.0;
201 
203 
204 };
205 
206 #endif //QGSLAYOUTTABLECOLUMN_H
void setHeading(const QString &heading)
Sets the heading for a column, which is the value displayed in the column&#39;s header cell...
Stores properties of a column for a QgsLayoutTable.
void setAttribute(const QString &attribute)
Sets the attribute name or expression used for the column&#39;s values.
Qt::AlignmentFlag hAlignment() const
Returns the horizontal alignment for a column, which controls the alignment used for drawing column v...
Qt::AlignmentFlag vAlignment() const
Returns the vertical alignment for a column, which controls the alignment used for drawing column val...
int sortByRank() const
Returns the sort rank for the column.
void setHAlignment(Qt::AlignmentFlag alignment)
Sets the horizontal alignment for a column, which controls the alignment used for drawing column valu...
void setSortByRank(int rank)
Sets the sort rank for the column.
double width() const
Returns the width for the column in mm, or 0 if column width is automatically calculated.
#define SIP_FACTORY
Definition: qgis_sip.h:69
Qt::SortOrder sortOrder() const
Returns the sort order for the column.
QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout.
void setWidth(const double width)
Sets the width for a column in mm.
QString attribute() const
Returns the attribute name or expression used for the column&#39;s values.
void setVAlignment(Qt::AlignmentFlag alignment)
Sets the vertical alignment for a column, which controls the alignment used for drawing column values...
void setSortOrder(Qt::SortOrder order)
Sets the sort order for the column.
QString heading() const
Returns the heading for a column, which is the value displayed in the column&#39;s header cell...