QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 <QDomDocument>
22 #include <QDomElement>
23 #include <QColor>
24 
25 #include "qgis_core.h"
26 #include "qgis_sip.h"
27 
36 class CORE_EXPORT QgsLayoutTableColumn
37 {
38  public:
39 
44  QgsLayoutTableColumn( const QString &heading = QString() );
45 
52  bool writeXml( QDomElement &columnElem, QDomDocument &doc ) const;
53 
59  bool readXml( const QDomElement &columnElem );
60 
66  double width() const { return mWidth; }
67 
72  void setWidth( const double width ) { mWidth = width; }
73 
79  QString heading() const { return mHeading; }
80 
86  void setHeading( const QString &heading ) { mHeading = heading; }
87 
94  Qt::AlignmentFlag hAlignment() const { return mHAlignment; }
95 
102  void setHAlignment( Qt::AlignmentFlag alignment ) { mHAlignment = alignment; }
103 
110  Qt::AlignmentFlag vAlignment() const { return mVAlignment; }
111 
118  void setVAlignment( Qt::AlignmentFlag alignment ) { mVAlignment = alignment; }
119 
126  QString attribute() const { return mAttribute; }
127 
134  void setAttribute( const QString &attribute ) { mAttribute = attribute; }
135 
143  Qt::SortOrder sortOrder() const { return mSortOrder; }
144 
152  void setSortOrder( Qt::SortOrder order ) { mSortOrder = order; }
153 
168  Q_DECL_DEPRECATED int sortByRank() const SIP_DEPRECATED { return mSortByRank; }
169 
183  Q_DECL_DEPRECATED void setSortByRank( int rank ) SIP_DEPRECATED { mSortByRank = rank; }
184 
190  Q_DECL_DEPRECATED QgsLayoutTableColumn *clone() SIP_DEPRECATED SIP_FACTORY {return new QgsLayoutTableColumn( *this );}
191 
192  bool operator==( const QgsLayoutTableColumn &other )
193  {
194  return mHeading == other.mHeading
195  && mAttribute == other.mAttribute
196  && mSortByRank == other.mSortByRank
197  && mSortOrder == other.mSortOrder
198  && mWidth == other.mWidth
199  && mHAlignment == other.mHAlignment
200  && mVAlignment == other.mVAlignment;
201  }
202 
203  private:
204 
205  QString mHeading;
206  QString mAttribute;
207  int mSortByRank = 0;
208  Qt::SortOrder mSortOrder = Qt::AscendingOrder;
209  double mWidth = 0.0;
210  QColor mBackgroundColor = Qt::transparent; //currently unused
211  Qt::AlignmentFlag mHAlignment = Qt::AlignLeft;
212  Qt::AlignmentFlag mVAlignment = Qt::AlignVCenter;
213 
215 
216 };
217 #endif //QGSLAYOUTTABLECOLUMN_H
QgsLayoutTableColumn::operator==
bool operator==(const QgsLayoutTableColumn &other)
Definition: qgslayouttablecolumn.h:192
QgsLayoutTableColumn::width
double width() const
Returns the width for the column in mm, or 0 if column width is automatically calculated.
Definition: qgslayouttablecolumn.h:66
QgsLayoutTableColumn::setSortByRank
Q_DECL_DEPRECATED void setSortByRank(int rank)
Sets the sort rank for the column.
Definition: qgslayouttablecolumn.h:183
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
QgsCompositionConverter
QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout.
Definition: qgscompositionconverter.h:55
QgsLayoutTableColumn::clone
Q_DECL_DEPRECATED QgsLayoutTableColumn * clone()
Creates a duplicate column which is a deep copy of this column.
Definition: qgslayouttablecolumn.h:190
QgsLayoutTableColumn::vAlignment
Qt::AlignmentFlag vAlignment() const
Returns the vertical alignment for a column, which controls the alignment used for drawing column val...
Definition: qgslayouttablecolumn.h:110
QgsLayoutTableColumn::heading
QString heading() const
Returns the heading for a column, which is the value displayed in the column's header cell.
Definition: qgslayouttablecolumn.h:79
QgsLayoutTableColumn::setHAlignment
void setHAlignment(Qt::AlignmentFlag alignment)
Sets the horizontal alignment for a column, which controls the alignment used for drawing column valu...
Definition: qgslayouttablecolumn.h:102
qgis_sip.h
QgsLayoutTableColumn::setAttribute
void setAttribute(const QString &attribute)
Sets the attribute name or expression used for the column's values.
Definition: qgslayouttablecolumn.h:134
QgsLayoutTableColumn::attribute
QString attribute() const
Returns the attribute name or expression used for the column's values.
Definition: qgslayouttablecolumn.h:126
QgsLayoutTableColumn::sortOrder
Qt::SortOrder sortOrder() const
Returns the sort order for the column.
Definition: qgslayouttablecolumn.h:143
QgsLayoutTableColumn::setVAlignment
void setVAlignment(Qt::AlignmentFlag alignment)
Sets the vertical alignment for a column, which controls the alignment used for drawing column values...
Definition: qgslayouttablecolumn.h:118
QgsLayoutTableColumn::setHeading
void setHeading(const QString &heading)
Sets the heading for a column, which is the value displayed in the column's header cell.
Definition: qgslayouttablecolumn.h:86
QgsLayoutTableColumn::setWidth
void setWidth(const double width)
Sets the width for a column in mm.
Definition: qgslayouttablecolumn.h:72
QgsLayoutTableColumn::hAlignment
Qt::AlignmentFlag hAlignment() const
Returns the horizontal alignment for a column, which controls the alignment used for drawing column v...
Definition: qgslayouttablecolumn.h:94
QgsLayoutTableColumn::setSortOrder
void setSortOrder(Qt::SortOrder order)
Sets the sort order for the column.
Definition: qgslayouttablecolumn.h:152
QgsLayoutTableColumn::sortByRank
Q_DECL_DEPRECATED int sortByRank() const
Returns the sort rank for the column.
Definition: qgslayouttablecolumn.h:168
QgsLayoutTableColumn
Stores properties of a column for a QgsLayoutTable.
Definition: qgslayouttablecolumn.h:37