Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[composer] Make getFeatureAttributes public for tables
  • Loading branch information
nyalldawson committed Apr 28, 2014
1 parent d070558 commit ebb31de
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
4 changes: 0 additions & 4 deletions src/core/composer/qgscomposerattributetable.h
Expand Up @@ -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:
Expand Down
14 changes: 10 additions & 4 deletions src/core/composer/qgscomposertable.h
Expand Up @@ -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.
Expand Down Expand Up @@ -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*/
Expand Down
15 changes: 12 additions & 3 deletions src/core/composer/qgscomposertexttable.h
Expand Up @@ -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:
Expand Down

0 comments on commit ebb31de

Please sign in to comment.