Skip to content

Commit ebb31de

Browse files
committedApr 28, 2014
[composer] Make getFeatureAttributes public for tables
1 parent d070558 commit ebb31de

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed
 

‎src/core/composer/qgscomposerattributetable.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,6 @@ class CORE_EXPORT QgsComposerAttributeTable: public QgsComposerTable
220220

221221
QMap<int, QString> headerLabels() const;
222222

223-
protected:
224-
/**Retrieves feature attributes
225-
* @note not available in python bindings
226-
*/
227223
bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps );
228224

229225
private:

‎src/core/composer/qgscomposertable.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ class CORE_EXPORT QgsComposerTable: public QgsComposerItem
6969
*/
7070
virtual QMap<int, QString> headerLabels() const { return QMap<int, QString>(); } //= 0;
7171

72+
//TODO - make this more generic for next API break, eg rename as getRowValues, use QStringList rather than
73+
//QgsAttributeMap
74+
75+
/*Fetches the text used for the rows of the table.
76+
* @returns true if attribute text was successfully retrieved.
77+
* @param attributeMaps QList of QgsAttributeMap to store retrieved row data in
78+
* @note not available in python bindings
79+
*/
80+
virtual bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps ) { Q_UNUSED( attributeMaps ); return false; }
81+
7282
public slots:
7383

7484
/**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
102112
QList<QgsAttributeMap> mAttributeMaps;
103113
QMap<int, double> mMaxColumnWidthMap;
104114

105-
/**Retrieves feature attributes*/
106-
//! @note not available in python bindings
107-
virtual bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps ) { Q_UNUSED( attributeMaps ); return false; }
108-
109115
/**Calculate the maximum width values of the vector attributes*/
110116
virtual bool calculateMaxColumnWidths( QMap<int, double>& maxWidthMap, const QList<QgsAttributeMap>& attributeMaps ) const;
111117
/**Adapts the size of the item frame to match the content*/

‎src/core/composer/qgscomposertexttable.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,25 @@ class CORE_EXPORT QgsComposerTextTable: public QgsComposerTable
3030
/** return correct graphics item type. Added in v1.7 */
3131
virtual int type() const { return ComposerTextTable; }
3232

33-
void setHeaderLabels( const QStringList& l ) { mHeaderLabels = l; }
33+
/*Sets the text to use for the header row for the table
34+
* @param labels list of strings to use for each column's header row
35+
* @see headerLabels
36+
*/
37+
void setHeaderLabels( const QStringList& labels ) { mHeaderLabels = labels; }
38+
39+
/*Adds a row to the table
40+
* @param row list of strings to use for each cell's value in the newly added row
41+
* @note If row is shorter than the number of columns in the table than blank cells
42+
* will be inserted at the end of the row. If row contains more strings then the number
43+
* of columns in the table then these extra strings will be ignored.
44+
*/
3445
void addRow( const QStringList& row ) { mRowText.append( row ); }
3546

3647
bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
3748
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
3849

3950
QMap<int, QString> headerLabels() const;
4051

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

4554
private:

0 commit comments

Comments
 (0)
Please sign in to comment.