QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgscomposertexttable.cpp
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 #include "qgscomposertexttable.h"
19 
21 {
22 
23 }
24 
26 {
27 
28 }
29 
30 bool QgsComposerTextTable::writeXML( QDomElement& elem, QDomDocument & doc ) const
31 {
32  QDomElement composerTableElem = doc.createElement( "ComposerTextTable" );
33  //todo: write headers and text entries
34  bool ok = _writeXML( composerTableElem , doc );
35  elem.appendChild( composerTableElem );
36  return ok;
37 }
38 
39 bool QgsComposerTextTable::readXML( const QDomElement& itemElem, const QDomDocument& doc )
40 {
41  //todo: read headers and text entries
42  return tableReadXML( itemElem, doc );
43 }
44 
45 bool QgsComposerTextTable::getFeatureAttributes( QList<QgsAttributes>& attributes )
46 {
47  attributes.clear();
48 
49  QList< QStringList >::const_iterator rowIt = mRowText.constBegin();
50  QStringList currentStringList;
51  for ( ; rowIt != mRowText.constEnd(); ++rowIt )
52  {
53  currentStringList = *rowIt;
54  QVector<QVariant> vec;
55  for ( int i = 0; i < currentStringList.size(); ++i )
56  {
57  vec.append( QVariant( currentStringList.at( i ) ) );
58  }
59  attributes.append( vec );
60  }
61  return true;
62 }
63 
64 QMap<int, QString> QgsComposerTextTable::getHeaderLabels() const
65 {
66  QMap<int, QString> header;
67  QStringList::const_iterator it = mHeaderLabels.constBegin();
68  int index = 0;
69  for ( ; it != mHeaderLabels.constEnd(); ++it )
70  {
71  header.insert( index, *it );
72  ++index;
73  }
74  return header;
75 }
76 
77