From d0d681cf5935d1c6b6c2b31704c2bfe73221799d Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 15 Apr 2014 21:16:44 +1000 Subject: [PATCH] [composer] Fix QgsComposerTextTable always blank --- src/core/composer/qgscomposertexttable.cpp | 11 ++++++----- src/core/composer/qgscomposertexttable.h | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/core/composer/qgscomposertexttable.cpp b/src/core/composer/qgscomposertexttable.cpp index 4e0b3105198..e1bc2802e98 100644 --- a/src/core/composer/qgscomposertexttable.cpp +++ b/src/core/composer/qgscomposertexttable.cpp @@ -42,22 +42,23 @@ bool QgsComposerTextTable::readXML( const QDomElement& itemElem, const QDomDocum return tableReadXML( itemElem, doc ); } -bool QgsComposerTextTable::getFeatureAttributes( QList& attributes ) +bool QgsComposerTextTable::getFeatureAttributes( QList& attributeMaps ) { - attributes.clear(); + attributeMaps.clear(); QList< QStringList >::const_iterator rowIt = mRowText.constBegin(); QStringList currentStringList; for ( ; rowIt != mRowText.constEnd(); ++rowIt ) { currentStringList = *rowIt; - QVector vec; + + attributeMaps.push_back( QgsAttributeMap() ); for ( int i = 0; i < currentStringList.size(); ++i ) { - vec.append( QVariant( currentStringList.at( i ) ) ); + attributeMaps.last().insert( i, QVariant( currentStringList.at( i ) ) ); } - attributes.append( vec ); } + return true; } diff --git a/src/core/composer/qgscomposertexttable.h b/src/core/composer/qgscomposertexttable.h index 99b3ac8df14..653d5101eb0 100644 --- a/src/core/composer/qgscomposertexttable.h +++ b/src/core/composer/qgscomposertexttable.h @@ -38,7 +38,8 @@ class CORE_EXPORT QgsComposerTextTable: public QgsComposerTable protected: //! @note not available in python bindings - bool getFeatureAttributes( QList& attributes ); + bool getFeatureAttributes( QList& attributeMaps ); + QMap getHeaderLabels() const; private: