QGIS API Documentation  2.14.0-Essen
qgscomposertexttable.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscomposertexttable.h
3  ----------------------
4  begin : April 2010
5  copyright : (C) 2010 by Marco Hugentobler
6  email : marco at hugis dot net
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 QGSCOMPOSERTEXTTABLE_H
19 #define QGSCOMPOSERTEXTTABLE_H
20 
21 #include "qgscomposertable.h"
22 #include "qgscomposertablev2.h"
23 
25 class CORE_EXPORT QgsComposerTextTable: public QgsComposerTable
26 {
27  Q_OBJECT
28  public:
31 
33  virtual int type() const override { return ComposerTextTable; }
34 
39  void setHeaderLabels( const QStringList& labels );
40 
47  void addRow( const QStringList& row ) { mRowText.append( row ); }
48 
54  bool writeXML( QDomElement& elem, QDomDocument & doc ) const override;
55 
61  bool readXML( const QDomElement& itemElem, const QDomDocument& doc ) override;
62 
68  bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps ) override;
69 
70  private:
72  QList< QStringList > mRowText;
73 };
74 
78 class CORE_EXPORT QgsComposerTextTableV2 : public QgsComposerTableV2
79 {
80 
81  Q_OBJECT
82 
83  public:
84  QgsComposerTextTableV2( QgsComposition* c, bool createUndoCommands );
86 
94  void addRow( const QStringList& row );
95 
100  void setContents( const QList< QStringList >& contents );
101 
102  bool getTableContents( QgsComposerTableContents &contents ) override;
103 
104  virtual void addFrame( QgsComposerFrame* frame, bool recalcFrameSizes = true ) override;
105 
106  private:
108  QList< QStringList > mRowText;
109 };
110 
111 #endif // QGSCOMPOSERTEXTTABLE_H
A text table item that reads text from string lists.
virtual int type() const override
Return correct graphics item type.
void addRow(const QStringList &row)
Adds a row to the table.
A class to display feature attributes in the print composer.
virtual void addFrame(QgsComposerFrame *frame, bool recalcFrameSizes=true)=0
Adds a frame to the multiframe.
A class to display a table in the print composer, and allow the table to span over multiple frames...
Graphics scene for map printing.
Frame item for a composer multiframe item.
virtual bool getFeatureAttributes(QList< QgsAttributeMap > &attributeMaps)
Fetches the text used for the rows of the table.
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const override=0
Stores item state in DOM element.
virtual bool getTableContents(QgsComposerTableContents &contents)=0
Fetches the contents used for the cells in the table.
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc) override=0
Sets item state from DOM element.
A text table item that reads text from string lists.