I am trying to use the SVGmarker symbol for displaying the point vector layer. I was able to change the default symbol for the point vector layer. but I am not getting an idea of using the SVGmarker symbol in place of the default symbol. I am using QGIS3 C++ APIs.Even any lead in python will be beneficial. for example :
path for SVGmarker symbol:"C:\OSGeo4W64\apps\qgis-ltr-dev\svg\food\food_bar.svg"
code snipped for changing vector layer symbol:
layer->startEditing();
qDebug()<< "is editable " << layer->isEditable();
QgsFeatureRenderer * layerRenderer= layer->renderer();
QgsSingleSymbolRenderer *mSingleRenderer = QgsSingleSymbolRenderer::convertFromRenderer(layerRenderer);
QgsMarkerSymbol* symbol = new QgsMarkerSymbol();
QgsStringMap mp;
mp[QString("fill")]= QString("red");
mp[QString("name")]= QString("food_bar.svg");
mp[QString("size")]= QString("6");
mp[QString("outline")]=QString("black");
mp[QString("outline-width")]=QString("6.8");
auto svgsymbol = QgsSvgMarkerSymbolLayer::create(mp);
auto newsym= symbol->createSimple(mp);
mSingleRenderer->setSymbol(newsym);
layer->setRenderer(mSingleRenderer);
layer->triggerRepaint();
layer->commitChanges();
qDebug()<< "is editable after commiting " << layer->isEditable();
In the above code, I am not able to provide a path of food_bar.svg icon. color and size are getting changed. but the icon is not coming.