QGIS API Documentation  2.12.0-Lyon
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  public:
30 
32  virtual int type() const override { return ComposerTextTable; }
33 
38  void setHeaderLabels( const QStringList& labels );
39 
46  void addRow( const QStringList& row ) { mRowText.append( row ); }
47 
53  bool writeXML( QDomElement& elem, QDomDocument & doc ) const override;
54 
60  bool readXML( const QDomElement& itemElem, const QDomDocument& doc ) override;
61 
67  bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps ) override;
68 
69  private:
71  QList< QStringList > mRowText;
72 };
73 
77 class CORE_EXPORT QgsComposerTextTableV2 : public QgsComposerTableV2
78 {
79 
80  Q_OBJECT
81 
82  public:
83  QgsComposerTextTableV2( QgsComposition* c, bool createUndoCommands );
85 
93  void addRow( const QStringList& row );
94 
99  void setContents( const QList< QStringList >& contents );
100 
101  bool getTableContents( QgsComposerTableContents &contents ) override;
102 
103  virtual void addFrame( QgsComposerFrame* frame, bool recalcFrameSizes = true ) override;
104 
105  private:
107  QList< QStringList > mRowText;
108 };
109 
110 #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.