Skip to content
Permalink
Browse files

Added binding files for composer attribute table

git-svn-id: http://svn.osgeo.org/qgis/trunk@14770 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Nov 26, 2010
1 parent ecae309 commit 91fa1e0da3db1e1238717511f16390c52ba5008a
@@ -12,13 +12,15 @@

%Include qgis.sip
%Include qgsapplication.sip
%Include qgscomposerattributetable.sip
%Include qgscomposeritem.sip
%Include qgscomposerlabel.sip
%Include qgscomposerlegend.sip
%Include qgscomposermap.sip
%Include qgscomposerpicture.sip
%Include qgscomposerscalebar.sip
%Include qgscomposershape.sip
%Include qgscomposertable.sip
%Include qgscomposition.sip
%Include qgslegendmodel.sip
%Include qgspaperitem.sip
@@ -0,0 +1,44 @@
/** \ingroup MapComposer
* Attribute table item for map composer.
*/

class QgsComposerAttributeTable: QgsComposerTable
{
%TypeHeaderCode
#include <qgscomposerattributetable.h>
%End

public:
QgsComposerAttributeTable( QgsComposition* composition /TransferThis/ );
~QgsComposerAttributeTable();

/** \brief Reimplementation of QCanvasItem::paint*/
virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );

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

void setVectorLayer( QgsVectorLayer* vl );
const QgsVectorLayer* vectorLayer() const;

void setComposerMap( const QgsComposerMap* map /TransferThis/ );
const QgsComposerMap* composerMap() const;

void setMaximumNumberOfFeatures( int nr );
int maximumNumberOfFeatures() const;

void setDisplayOnlyVisibleFeatures( bool b );
bool displayOnlyVisibleFeatures() const;

QSet<int> displayAttributes() const;
void setDisplayAttributes( const QSet<int>& attr );

QMap<int, QString> fieldAliasMap() const;
void setFieldAliasMap( const QMap<int, QString>& map );

/**Adapts mMaximumNumberOfFeatures depending on the rectangle height*/
void setSceneRect( const QRectF& rectangle );

//void setSortAttributes( const QList<QPair<int, bool> > att );
//QList<QPair<int, bool> > sortAttributes() const;
};
@@ -0,0 +1,43 @@
/**A class to display feature attributes in the print composer*/
class QgsComposerTable: QgsComposerItem
{
%TypeHeaderCode
#include <qgscomposertable.h>
%End

public:
QgsComposerTable( QgsComposition* composition /TransferThis/ );
virtual ~QgsComposerTable();

/** \brief Reimplementation of QCanvasItem::paint*/
virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );

virtual bool writeXML( QDomElement& elem, QDomDocument & doc ) const = 0;
virtual bool readXML( const QDomElement& itemElem, const QDomDocument& doc ) = 0;

void setLineTextDistance( double d );
double lineTextDistance() const;

void setHeaderFont( const QFont& f );
QFont headerFont() const;

void setContentFont( const QFont& f );
QFont contentFont() const;

void setShowGrid( bool show );
bool showGrid() const;

void setGridStrokeWidth( double w );
double gridStrokeWidth() const;

void setGridColor( const QColor& c );
QColor gridColor() const;

/**Adapts the size of the frame to match the content. This is normally done in the paint method, but sometimes \
it needs to be done before the first render*/
void adjustFrameToSize();

protected:
//virtual bool getFeatureAttributes( QList< QMap< int, QVariant> >& attributes );
//virtual QMap<int, QString> getHeaderLabels() const;
};
@@ -62,6 +62,8 @@ class QgsComposerView: QGraphicsView
void addComposerPicture( QgsComposerPicture* picture );
/**Adds a composer shape to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerShape( QgsComposerShape* shape );
/**Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerTable( QgsComposerAttributeTable* table );

/**Returns the composer main window*/
QMainWindow* composerWindow();
@@ -74,8 +74,8 @@ class CORE_EXPORT QgsComposerTable: public QgsComposerItem
QColor mGridColor;

/**Retrieves feature attributes*/
virtual bool getFeatureAttributes( QList<QgsAttributeMap>& attributes ) = 0;
virtual QMap<int, QString> getHeaderLabels() const = 0;
virtual bool getFeatureAttributes( QList<QgsAttributeMap>& attributes ) {return false;} //= 0;
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>& attributeList ) const;
/**Adapts the size of the item frame to match the content*/

0 comments on commit 91fa1e0

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