QT使用SVG

QSvgWidget svg(this);
QDomDocument doc("svg");
QDomElement el_svg = doc.createElement("svg");
doc.appendChild(el_svg);
el_svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
QDomElement el_circle = doc.createElement("circle");
el_svg.appendChild(el_circle);
el_circle.setAttribute("fill", "red");
el_circle.setAttribute("cx", "100");
el_circle.setAttribute("cy", "100");
el_circle.setAttribute("r", "50");

qDebug() << "XML:" << doc.toString();

svg.load(doc.toByteArray());
posted @ 2022-03-07 15:19  爱弹钢琴的卡农  阅读(477)  评论(0)    收藏  举报