Bug report #11790

Updated by Giovanni Manghi over 3 years ago

I try to use QgsDxfExport from python but failed adding vector layers using addLayers method. I tried passing argument as a list of lists or a list of tuples, but both makes qgis crashes.



It seems like SIP doesn't like QList<QPair<QgsVectorLayer*,int>> argument type : help(QgsDxfExport) in python console reports "QgsDxfExport.addLayers(unknown-type)".



Because I don't know how to make SIP recognize this type as a python list of tuples, I simply add a "addLayer" method as :



void QgsDxfExport::addLayer( QgsVectorLayer *layer, int featureID )

{

mLayers.append(QPair< QgsVectorLayer *, int >(layer, featureID));

}



Using this method, I successfully exported in DXF from python.



Attached a patch for the 3 concerned files : QgsDxfExport.cpp, QgsDxfExport.h and QgsDxfExport.sip.

Back