Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Represent svg in tab view
Forum Updated to NodeBB v4.3 + New Features

Represent svg in tab view

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dilshad
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • L Offline
      L Offline
      luca
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #3

        just a question, isn't it easier to just use
        @
        QSvgRenderer *svgRender;
        svgRender = new QSvgRenderer(file_str);

        QImage *imageSvg = new ....
        @

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved