[QGIS Commit] r14770 - in trunk/qgis: python/core python/gui src/core/composer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Nov 26 05:30:19 EST 2010


Author: mhugent
Date: 2010-11-26 02:30:19 -0800 (Fri, 26 Nov 2010)
New Revision: 14770

Added:
   trunk/qgis/python/core/qgscomposerattributetable.sip
   trunk/qgis/python/core/qgscomposertable.sip
Modified:
   trunk/qgis/python/core/core.sip
   trunk/qgis/python/gui/qgscomposerview.sip
   trunk/qgis/src/core/composer/qgscomposertable.h
Log:
Added binding files for composer attribute table

Modified: trunk/qgis/python/core/core.sip
===================================================================
--- trunk/qgis/python/core/core.sip	2010-11-25 22:36:34 UTC (rev 14769)
+++ trunk/qgis/python/core/core.sip	2010-11-26 10:30:19 UTC (rev 14770)
@@ -12,6 +12,7 @@
 
 %Include qgis.sip
 %Include qgsapplication.sip
+%Include qgscomposerattributetable.sip
 %Include qgscomposeritem.sip
 %Include qgscomposerlabel.sip
 %Include qgscomposerlegend.sip
@@ -19,6 +20,7 @@
 %Include qgscomposerpicture.sip
 %Include qgscomposerscalebar.sip
 %Include qgscomposershape.sip
+%Include qgscomposertable.sip
 %Include qgscomposition.sip
 %Include qgslegendmodel.sip
 %Include qgspaperitem.sip

Added: trunk/qgis/python/core/qgscomposerattributetable.sip
===================================================================
--- trunk/qgis/python/core/qgscomposerattributetable.sip	                        (rev 0)
+++ trunk/qgis/python/core/qgscomposerattributetable.sip	2010-11-26 10:30:19 UTC (rev 14770)
@@ -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;
+};

Added: trunk/qgis/python/core/qgscomposertable.sip
===================================================================
--- trunk/qgis/python/core/qgscomposertable.sip	                        (rev 0)
+++ trunk/qgis/python/core/qgscomposertable.sip	2010-11-26 10:30:19 UTC (rev 14770)
@@ -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;
+};

Modified: trunk/qgis/python/gui/qgscomposerview.sip
===================================================================
--- trunk/qgis/python/gui/qgscomposerview.sip	2010-11-25 22:36:34 UTC (rev 14769)
+++ trunk/qgis/python/gui/qgscomposerview.sip	2010-11-26 10:30:19 UTC (rev 14770)
@@ -62,6 +62,8 @@
     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();

Modified: trunk/qgis/src/core/composer/qgscomposertable.h
===================================================================
--- trunk/qgis/src/core/composer/qgscomposertable.h	2010-11-25 22:36:34 UTC (rev 14769)
+++ trunk/qgis/src/core/composer/qgscomposertable.h	2010-11-26 10:30:19 UTC (rev 14770)
@@ -74,8 +74,8 @@
     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*/



More information about the QGIS-commit mailing list