[Qgis-developer] Custom SVG issue in QGIS API

Tendfly niu niubob at hotmail.com
Mon Oct 13 00:39:34 PDT 2014


Hi all,

         I'm using QGIS-2.4.0 API to developing application.

I wrote a custom map canvas item called MyMapCanvasItemSvg that show SVG
items in canvas. 

It is well to load and display SVG from symbol library of QGIS (i.e. file
path: d:\QGIS Chugiak\apps\qgis\svg\symbol\*.svg),

But when I create a svg file using Adobe Illustrator 16.0.0(which is same as
Generator of symbol library's svg), it breaks. 

I don't know the key point of SVG, I searched the topic on mailing list,
only found the topic"Custom Symbology and Inkscape"(link
<http://osgeo-org.1560.x6.nabble.com/Custom-Symbology-and-Inkscape-td4139425
.html#a4139427> ),

It don't help.

         

Any advice appricated!

 

Here are parts of my MyMapCanvasItemSvg codes:

 

void paint(QPainter *painter)

{

         QImage svgImage(29, 29, QImage::Format_ARGB32);

         QPainter imagePainter(&svgImage);

         mSvgRenderer.render(&imagePainter);          //mSvgRenderer is a
object of QSvgRenderer, constructed using a svg file path

         painter->drawImage(QrectF(0, 0, 100, 80), svgImage, QRectF(0, 0,
100, 80));

}

 

Regards,

 

Bob

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20141013/98ccce12/attachment.html>


More information about the Qgis-developer mailing list