[composer] Fix QgsComposerTextTable always blank

This commit is contained in:
Nyall Dawson 2014-04-15 21:16:44 +10:00
parent b9bd4d247e
commit d0d681cf59
2 changed files with 8 additions and 6 deletions

View File

@ -42,22 +42,23 @@ bool QgsComposerTextTable::readXML( const QDomElement& itemElem, const QDomDocum
return tableReadXML( itemElem, doc ); return tableReadXML( itemElem, doc );
} }
bool QgsComposerTextTable::getFeatureAttributes( QList<QgsAttributes>& attributes ) bool QgsComposerTextTable::getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps )
{ {
attributes.clear(); attributeMaps.clear();
QList< QStringList >::const_iterator rowIt = mRowText.constBegin(); QList< QStringList >::const_iterator rowIt = mRowText.constBegin();
QStringList currentStringList; QStringList currentStringList;
for ( ; rowIt != mRowText.constEnd(); ++rowIt ) for ( ; rowIt != mRowText.constEnd(); ++rowIt )
{ {
currentStringList = *rowIt; currentStringList = *rowIt;
QVector<QVariant> vec;
attributeMaps.push_back( QgsAttributeMap() );
for ( int i = 0; i < currentStringList.size(); ++i ) 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; return true;
} }

View File

@ -38,7 +38,8 @@ class CORE_EXPORT QgsComposerTextTable: public QgsComposerTable
protected: protected:
//! @note not available in python bindings //! @note not available in python bindings
bool getFeatureAttributes( QList<QgsAttributes>& attributes ); bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps );
QMap<int, QString> getHeaderLabels() const; QMap<int, QString> getHeaderLabels() const;
private: private: