From ebb31de525a5aceea5d364b7b7d8d91f31be3e9b Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 28 Apr 2014 19:03:45 +1000 Subject: [PATCH] [composer] Make getFeatureAttributes public for tables --- src/core/composer/qgscomposerattributetable.h | 4 ---- src/core/composer/qgscomposertable.h | 14 ++++++++++---- src/core/composer/qgscomposertexttable.h | 15 ++++++++++++--- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/core/composer/qgscomposerattributetable.h b/src/core/composer/qgscomposerattributetable.h index 2f882a859aff..c6953489c147 100644 --- a/src/core/composer/qgscomposerattributetable.h +++ b/src/core/composer/qgscomposerattributetable.h @@ -220,10 +220,6 @@ class CORE_EXPORT QgsComposerAttributeTable: public QgsComposerTable QMap headerLabels() const; - protected: - /**Retrieves feature attributes - * @note not available in python bindings - */ bool getFeatureAttributes( QList& attributeMaps ); private: diff --git a/src/core/composer/qgscomposertable.h b/src/core/composer/qgscomposertable.h index e77e69963a6f..1cf78a6471bb 100644 --- a/src/core/composer/qgscomposertable.h +++ b/src/core/composer/qgscomposertable.h @@ -69,6 +69,16 @@ class CORE_EXPORT QgsComposerTable: public QgsComposerItem */ virtual QMap headerLabels() const { return QMap(); } //= 0; + //TODO - make this more generic for next API break, eg rename as getRowValues, use QStringList rather than + //QgsAttributeMap + + /*Fetches the text used for the rows of the table. + * @returns true if attribute text was successfully retrieved. + * @param attributeMaps QList of QgsAttributeMap to store retrieved row data in + * @note not available in python bindings + */ + virtual bool getFeatureAttributes( QList& attributeMaps ) { Q_UNUSED( attributeMaps ); return false; } + public slots: /**Refreshes the attributes shown in the table by querying the vector layer for new data. @@ -102,10 +112,6 @@ class CORE_EXPORT QgsComposerTable: public QgsComposerItem QList mAttributeMaps; QMap mMaxColumnWidthMap; - /**Retrieves feature attributes*/ - //! @note not available in python bindings - virtual bool getFeatureAttributes( QList& attributeMaps ) { Q_UNUSED( attributeMaps ); return false; } - /**Calculate the maximum width values of the vector attributes*/ virtual bool calculateMaxColumnWidths( QMap& maxWidthMap, const QList& attributeMaps ) const; /**Adapts the size of the item frame to match the content*/ diff --git a/src/core/composer/qgscomposertexttable.h b/src/core/composer/qgscomposertexttable.h index 087618cdaed4..fdacf616eb77 100644 --- a/src/core/composer/qgscomposertexttable.h +++ b/src/core/composer/qgscomposertexttable.h @@ -30,7 +30,18 @@ class CORE_EXPORT QgsComposerTextTable: public QgsComposerTable /** return correct graphics item type. Added in v1.7 */ virtual int type() const { return ComposerTextTable; } - void setHeaderLabels( const QStringList& l ) { mHeaderLabels = l; } + /*Sets the text to use for the header row for the table + * @param labels list of strings to use for each column's header row + * @see headerLabels + */ + void setHeaderLabels( const QStringList& labels ) { mHeaderLabels = labels; } + + /*Adds a row to the table + * @param row list of strings to use for each cell's value in the newly added row + * @note If row is shorter than the number of columns in the table than blank cells + * will be inserted at the end of the row. If row contains more strings then the number + * of columns in the table then these extra strings will be ignored. + */ void addRow( const QStringList& row ) { mRowText.append( row ); } bool writeXML( QDomElement& elem, QDomDocument & doc ) const; @@ -38,8 +49,6 @@ class CORE_EXPORT QgsComposerTextTable: public QgsComposerTable QMap headerLabels() const; - protected: - //! @note not available in python bindings bool getFeatureAttributes( QList& attributeMaps ); private: