[composer] Make getFeatureAttributes public for tables

This commit is contained in:
Nyall Dawson 2014-04-28 19:03:45 +10:00
parent d070558bb2
commit ebb31de525
3 changed files with 22 additions and 11 deletions

View File

@ -220,10 +220,6 @@ class CORE_EXPORT QgsComposerAttributeTable: public QgsComposerTable
QMap<int, QString> headerLabels() const;
protected:
/**Retrieves feature attributes
* @note not available in python bindings
*/
bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps );
private:

View File

@ -69,6 +69,16 @@ class CORE_EXPORT QgsComposerTable: public QgsComposerItem
*/
virtual QMap<int, QString> headerLabels() const { return QMap<int, QString>(); } //= 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<QgsAttributeMap>& 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<QgsAttributeMap> mAttributeMaps;
QMap<int, double> mMaxColumnWidthMap;
/**Retrieves feature attributes*/
//! @note not available in python bindings
virtual bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps ) { Q_UNUSED( attributeMaps ); return false; }
/**Calculate the maximum width values of the vector attributes*/
virtual bool calculateMaxColumnWidths( QMap<int, double>& maxWidthMap, const QList<QgsAttributeMap>& attributeMaps ) const;
/**Adapts the size of the item frame to match the content*/

View File

@ -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<int, QString> headerLabels() const;
protected:
//! @note not available in python bindings
bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps );
private: