SVG Export in QCAD is completely implemented in ECMAScript with one of the main classes being SvgExporterPG:
The export can be done through funciton 'exportFile':