Skip to content
Permalink
Browse files

[composer] Make getFeatureAttributes public for tables

  • Loading branch information
nyalldawson committed Apr 28, 2014
1 parent d070558 commit ebb31de525a5aceea5d364b7b7d8d91f31be3e9b
@@ -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:
@@ -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*/
@@ -30,16 +30,25 @@ 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;
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );

QMap<int, QString> headerLabels() const;

protected:
//! @note not available in python bindings
bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps );

private:

0 comments on commit ebb31de

Please sign in to comment.
You can’t perform that action at this time.