QGIS API Documentation  2.99.0-Master (b058df7)
qgscomposertablecolumn.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscomposertablecolumn.h
3  ------------------
4  begin : May 2014
5  copyright : (C) 2014 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 QGSCOMPOSERTABLECOLUMN_H
19 #define QGSCOMPOSERTABLECOLUMN_H
20 
21 #include <QObject>
22 #include <QDomDocument>
23 #include <QDomElement>
24 #include <QColor>
25 
26 #include "qgis_core.h"
27 
33 class CORE_EXPORT QgsComposerTableColumn: public QObject
34 {
35  Q_OBJECT
36 
37  public:
38 
43  QgsComposerTableColumn( const QString &heading = QString() );
44 
52  virtual bool writeXml( QDomElement &columnElem, QDomDocument &doc ) const;
53 
60  virtual bool readXml( const QDomElement &columnElem );
61 
68  double width() const { return mWidth; }
69 
76  void setWidth( const double width ) { mWidth = width; }
77 
85  QString heading() const { return mHeading; }
86 
94  void setHeading( const QString &heading ) { mHeading = heading; }
95 
104  Qt::AlignmentFlag hAlignment() const { return mHAlignment; }
105 
114  void setHAlignment( Qt::AlignmentFlag alignment ) { mHAlignment = alignment; }
115 
124  Qt::AlignmentFlag vAlignment() const { return mVAlignment; }
125 
134  void setVAlignment( Qt::AlignmentFlag alignment ) { mVAlignment = alignment; }
135 
144  QString attribute() const { return mAttribute; }
145 
154  void setAttribute( const QString &attribute ) { mAttribute = attribute; }
155 
165  Qt::SortOrder sortOrder() const { return mSortOrder; }
166 
176  void setSortOrder( Qt::SortOrder sortOrder ) { mSortOrder = sortOrder; }
177 
191  int sortByRank() const { return mSortByRank; }
192 
206  void setSortByRank( int sortByRank ) { mSortByRank = sortByRank; }
207 
213  QgsComposerTableColumn *clone();
214 
215  private:
216 
217  QColor mBackgroundColor; //currently unused
218  Qt::AlignmentFlag mHAlignment = Qt::AlignLeft;
219  Qt::AlignmentFlag mVAlignment = Qt::AlignVCenter;
220  QString mHeading;
221  QString mAttribute;
222  int mSortByRank = 0;
223  Qt::SortOrder mSortOrder = Qt::AscendingOrder;
224  double mWidth = 0.0;
225 
226 };
227 
228 #endif // QGSCOMPOSERTABLECOLUMN_H
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...
void setHAlignment(Qt::AlignmentFlag alignment)
Sets the horizontal alignment for a column, which controls the alignment used for drawing column valu...
void setHeading(const QString &heading)
Sets the heading for a column, which is the value displayed in the columns header cell...
int sortByRank() const
Returns the sort rank for the column.
Stores properties of a column in a QgsComposerTable.
double width() const
Returns the width for a column.
QString heading() const
Returns the heading for a column, which is the value displayed in the columns header cell...
void setSortOrder(Qt::SortOrder sortOrder)
Sets the sort order for the column.
void setVAlignment(Qt::AlignmentFlag alignment)
Sets the vertical alignment for a column, which controls the alignment used for drawing column values...
QString attribute() const
Returns the attribute name or expression used for the column&#39;s values.
void setWidth(const double width)
Sets the width for a column.
Qt::SortOrder sortOrder() const
Returns the sort order for the column.
void setSortByRank(int sortByRank)
Sets the sort rank for the column.