[Qgis-developer] Add multiple frames to a composer attribute table using PyQGIS

James Stott jamesstott1 at gmail.com
Sun Nov 1 01:09:00 PST 2015


I have an attribute table that is around two hundred rows of data (but only
two columns wide). I would like to add an attribute table to a composer
with this data, and to do this I need to add multiple frames so I can add
the whole attribute table to one page. Doing this manually in the composer
I just add 5 frames side by side to one composer page, and I manage to get
all my data on one page.

I cannot figure out how to add an attribute table with multiple frames to a
composer using PyQGIS. I am problably missing something really obvious, but
I am stuck here.

When I try to define a QgsComposerFrame, I am told that I must specify the
QgsComposerMultiFrame it belongs to:

QgsComposerFrame
<http://qgis.org/api/classQgsComposerFrame.html#ab645cf6db9a1285a6983e05541f2d28f>
 (QgsComposition <http://qgis.org/api/classQgsComposition.html> *c,
QgsComposerMultiFrame
<http://qgis.org/api/classQgsComposerMultiFrame.html> *mf,
qreal x <http://doc.qt.io/qt-4.8/qgraphicsitem.html#x>, qreal y
<http://doc.qt.io/qt-4.8/qgraphicsitem.html#y>, qreal width, qreal height)

How do I create the QgsComposerMultiFrame. It is an abstract class, I am
told that it is an abstract class and cannot be instantiated. If I try

multiFrame = QgsComposerMultiFrame(myCompositionTable, False)

I get the following error when I run my code.

qgis._core.QgsComposerMultiFrame represents a C++ abstract class and cannot
be instantiated

I cant find any documentation or examples on how to do this. So if someone
could shed some light on this it would be most appreciated. I am happy to
write up a bit of documentation once I have managed to do this.

Many thanks,

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20151101/fbd48aa9/attachment.html>


More information about the Qgis-developer mailing list