QGIS API Documentation  2.15.0-Master (94d88e6)
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 
27 //TODO QGIS 3.0 - remove
28 class CORE_EXPORT QgsComposerTextTable: public QgsComposerTable
29 {
30  Q_OBJECT
31  public:
34 
36  virtual int type() const override { return ComposerTextTable; }
37 
42  void setHeaderLabels( const QStringList& labels );
43 
50  void addRow( const QStringList& row ) { mRowText.append( row ); }
51 
57  bool writeXML( QDomElement& elem, QDomDocument & doc ) const override;
58 
64  bool readXML( const QDomElement& itemElem, const QDomDocument& doc ) override;
65 
71  bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps ) override;
72 
73  private:
75  QList< QStringList > mRowText;
76 };
77 
81 class CORE_EXPORT QgsComposerTextTableV2 : public QgsComposerTableV2
82 {
83 
84  Q_OBJECT
85 
86  public:
87  QgsComposerTextTableV2( QgsComposition* c, bool createUndoCommands );
89 
97  void addRow( const QStringList& row );
98 
103  void setContents( const QList< QStringList >& contents );
104 
105  bool getTableContents( QgsComposerTableContents &contents ) override;
106 
107  virtual void addFrame( QgsComposerFrame* frame, bool recalcFrameSizes = true ) override;
108 
109  private:
111  QList< QStringList > mRowText;
112 };
113 
114 #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.