mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
[composer] Rename getHeaderLabels to headerLabels and make it public for composer text/attribute tables.
This commit is contained in:
parent
98fac7957e
commit
e0c64028b5
@ -190,9 +190,6 @@ class QgsComposerAttributeTable : QgsComposerTable
|
||||
// @note not available in python bindings
|
||||
// QList<QPair<int, bool> > sortAttributes() const;
|
||||
|
||||
protected:
|
||||
virtual QMap<int, QString> getHeaderLabels() const;
|
||||
|
||||
signals:
|
||||
/**This signal is emitted if the maximum number of feature changes (interactively)*/
|
||||
void maximumNumberOfFeaturesChanged( int n );
|
||||
|
@ -58,7 +58,7 @@ class QgsComposerTable: QgsComposerItem
|
||||
protected:
|
||||
/**Retrieves feature attributes*/
|
||||
// virtual bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps );
|
||||
virtual QMap<int, QString> getHeaderLabels() const;
|
||||
|
||||
/**Calculate the maximum width values of the vector attributes*/
|
||||
// virtual bool calculateMaxColumnWidths( QMap<int, double>& maxWidthMap, const QList< QMap<int, QVariant> >& attributeMaps ) const;
|
||||
/**Adapts the size of the item frame to match the content*/
|
||||
|
@ -16,8 +16,4 @@ class QgsComposerTextTable: QgsComposerTable
|
||||
bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
|
||||
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
|
||||
|
||||
protected:
|
||||
//! @note not available in python bindings
|
||||
// bool getFeatureAttributes( QList< QMap<int, QVariant> >& attributes );
|
||||
QMap<int, QString> getHeaderLabels() const;
|
||||
};
|
||||
|
@ -297,7 +297,7 @@ bool QgsComposerAttributeTable::getFeatureAttributes( QList<QgsAttributeMap> &at
|
||||
return true;
|
||||
}
|
||||
|
||||
QMap<int, QString> QgsComposerAttributeTable::getHeaderLabels() const
|
||||
QMap<int, QString> QgsComposerAttributeTable::headerLabels() const
|
||||
{
|
||||
QMap<int, QString> header;
|
||||
if ( mVectorLayer )
|
||||
|
@ -218,15 +218,14 @@ class CORE_EXPORT QgsComposerAttributeTable: public QgsComposerTable
|
||||
*/
|
||||
QList<QPair<int, bool> > sortAttributes() const { return mSortInformation; }
|
||||
|
||||
QMap<int, QString> headerLabels() const;
|
||||
|
||||
protected:
|
||||
/**Retrieves feature attributes
|
||||
* @note not available in python bindings
|
||||
*/
|
||||
bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps );
|
||||
|
||||
//! @note not available in python bindings
|
||||
QMap<int, QString> getHeaderLabels() const;
|
||||
|
||||
private:
|
||||
/**Associated vector layer*/
|
||||
QgsVectorLayer* mVectorLayer;
|
||||
|
@ -83,7 +83,7 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*
|
||||
double currentX = mGridStrokeWidth;
|
||||
double currentY;
|
||||
|
||||
QMap<int, QString> headerMap = getHeaderLabels();
|
||||
QMap<int, QString> headerMap = headerLabels();
|
||||
QMap<int, QString>::const_iterator columnIt = headerMap.constBegin();
|
||||
|
||||
for ( ; columnIt != headerMap.constEnd(); ++columnIt )
|
||||
@ -229,7 +229,7 @@ bool QgsComposerTable::tableReadXML( const QDomElement& itemElem, const QDomDocu
|
||||
bool QgsComposerTable::calculateMaxColumnWidths( QMap<int, double>& maxWidthMap, const QList<QgsAttributeMap>& attributeMaps ) const
|
||||
{
|
||||
maxWidthMap.clear();
|
||||
QMap<int, QString> headerMap = getHeaderLabels();
|
||||
QMap<int, QString> headerMap = headerLabels();
|
||||
QMap<int, QString>::const_iterator headerIt = headerMap.constBegin();
|
||||
for ( ; headerIt != headerMap.constEnd(); ++headerIt )
|
||||
{
|
||||
|
@ -61,6 +61,14 @@ class CORE_EXPORT QgsComposerTable: public QgsComposerItem
|
||||
void setGridColor( const QColor& c ) { mGridColor = c; }
|
||||
QColor gridColor() const { return mGridColor; }
|
||||
|
||||
/*Returns the text used in the column headers for the table.
|
||||
* @returns QMap of int to QString, where the int is the column index (starting at 0),
|
||||
* and the string is the text to use for the column's header
|
||||
* @note added in 2.3
|
||||
* @note not available in python bindings
|
||||
*/
|
||||
virtual QMap<int, QString> headerLabels() const { return QMap<int, QString>(); } //= 0;
|
||||
|
||||
public slots:
|
||||
|
||||
/**Refreshes the attributes shown in the table by querying the vector layer for new data.
|
||||
@ -97,7 +105,7 @@ class CORE_EXPORT QgsComposerTable: public QgsComposerItem
|
||||
/**Retrieves feature attributes*/
|
||||
//! @note not available in python bindings
|
||||
virtual bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps ) { Q_UNUSED( attributeMaps ); return false; }
|
||||
virtual QMap<int, QString> getHeaderLabels() const { return QMap<int, QString>(); } //= 0;
|
||||
|
||||
/**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*/
|
||||
|
@ -62,7 +62,7 @@ bool QgsComposerTextTable::getFeatureAttributes( QList<QgsAttributeMap>& attribu
|
||||
return true;
|
||||
}
|
||||
|
||||
QMap<int, QString> QgsComposerTextTable::getHeaderLabels() const
|
||||
QMap<int, QString> QgsComposerTextTable::headerLabels() const
|
||||
{
|
||||
QMap<int, QString> header;
|
||||
QStringList::const_iterator it = mHeaderLabels.constBegin();
|
||||
|
@ -36,12 +36,12 @@ class CORE_EXPORT QgsComposerTextTable: public QgsComposerTable
|
||||
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 );
|
||||
|
||||
QMap<int, QString> getHeaderLabels() const;
|
||||
|
||||
private:
|
||||
/**Column titles*/
|
||||
QStringList mHeaderLabels;
|
||||
|
Loading…
x
Reference in New Issue
Block a user