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 (! | QIODevice::Text))
    svgArray = file_svg.readAll();
    QSvgRenderer *svgRender;
    svgRender = new QSvgRenderer(svgArray);

    QImage *imageSvg = new QImage(dim, QImage::Format_ARGB32);
    QPainter p;
    svgRender->render(&p, id);


    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 ....

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.