Represent svg in tab view
-
Hello all,
I have an svg file which has a lot of graphs representing different values.
Is it possible to represent each graph separately in tab view?
Thanking you in advance -
Hi,
if the svg item you want to separate are grouped in a "group" and has an id that you know so you can use:@
QFile file_svg (file_str);
if (!file_svg.open(QIODevice::ReadOnly | QIODevice::Text))
return;
svgArray = file_svg.readAll();
file_svg.close();
QSvgRenderer *svgRender;
svgRender = new QSvgRenderer(svgArray);QImage *imageSvg = new QImage(dim, QImage::Format_ARGB32);
....
svgRender->load(svgArray);
QPainter p;
p.begin(imageSvg);
svgRender->render(&p, id);
p.end();....
@where "id" is the id (QString) of the object you want to put in the QPainter.
Next you can show the imageSvg where you want.
-
just a question, isn't it easier to just use
@
QSvgRenderer *svgRender;
svgRender = new QSvgRenderer(file_str);QImage *imageSvg = new ....
@