[Qgis-developer] Adding python bindings for quickprint

Tim Sutton tim at linfiniti.com
Tue Jan 15 13:30:33 EST 2008


Hi Martin

A bit more on this - I discovered my patch actually wasnt  compiling properly:

/Users/timlinux/dev/cpp/qgis/src/gui/qgsquickprint.h: In copy
constructor 'QgsQuickPrint::QgsQuickPrint(const QgsQuickPrint&)':
/Users/timlinux/dev/cpp/qgis/src/gui/qgsquickprint.h:36:
instantiated from 'void* qMetaTypeConstructHelper(const T*) [with T =
QgsQuickPrint]'
/Library/Frameworks/QtCore.framework/Headers/qmetatype.h:144:
instantiated from 'int qRegisterMetaType(const char*, T*) [with T =
QgsQuickPrint]'
sipguicmodule.cpp:702:   instantiated from here
/Library/Frameworks/QtCore.framework/Headers/qobject.h:285: error:
'QObject::QObject(const QObject&)' is private
/Users/timlinux/dev/cpp/qgis/src/gui/qgsquickprint.h:36: error: within
this context
/Library/Frameworks/QtCore.framework/Headers/qmetatype.h: In function
'void* qMetaTypeConstructHelper(const T*) [with T = QgsQuickPrint]':
/Library/Frameworks/QtCore.framework/Headers/qmetatype.h:119: warning:
synthesized method 'QgsQuickPrint::QgsQuickPrint(const
QgsQuickPrint&)' first required here
make[3]: *** [sipguicmodule.o] Error 1
make[2]: *** [python/gui/gui.so] Error 2
make[1]: *** [python/CMakeFiles/python.dir/all] Error 2
make: *** [all] Error 2


I saw in som of your wrapped classes you mentioned problems wih
inheriting QObject in python wrapped code - did you find a work around
for that?

Regards

Tim

2008/1/15, Tim Sutton <tim at linfiniti.com>:
> Hi Martin
>
> I want to create python bindings for QuickPrint class. I copied work
> you did for other classes (see attached patch) and it all compiles
> fine. Bearing in mind that Im a complete python noob how do I:
>
>  -  confirm my class is available in the pythond bindings? I tried in
> the python console to do like  qp = QgsQuickPrint but it gave an error
>  -  is there something like Doxygen API that I can read the api docs for python
>  - I looked through all the examples I could find and none of the
> python stuff I saw seemed to make use of qgis classes directly - they
> all seem to pull objects out of the iface object. Where can I find
> better examples?
>
> the quick print class *should* work something like this:
>
> qp = QgsQuickPrint
> qp.setMapCanvas ( iface.getMapCanvas() )
> qp.setOutputPdf ("/tmp/test;pdf")
> qp.setTitle ("QGIS Rocks")
> qp.print()
>
> Regards
>
> Tim
>
> --
> Tim Sutton
> QGIS Project Steering Committee Member - Release  Manager
> Visit http://qgis.org for a great open source GIS
> openModeller Desktop Developer
> Visit http://openModeller.sf.net for a great open source ecological
> niche modelling tool
> Home Page: http://tim.linfiniti.com
> Skype: timlinux
> Irc: timlinux on #qgis at freenode.net
>
>


-- 
Tim Sutton
QGIS Project Steering Committee Member - Release  Manager
Visit http://qgis.org for a great open source GIS
openModeller Desktop Developer
Visit http://openModeller.sf.net for a great open source ecological
niche modelling tool
Home Page: http://tim.linfiniti.com
Skype: timlinux
Irc: timlinux on #qgis at freenode.net



More information about the Qgis-developer mailing list