Results 1 to 6 of 6

Thread: represent svg in tab view

  1. #1
    Join Date
    Jul 2010
    Posts
    25
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default 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

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: represent svg in tab view

    Theoretically yes, but as far as I know QtSVG has no option to only show one "graph" identified by an id. But you can do a workaround by loading your svg with QDomDocument and strip the non needed graphs out and then display it.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: represent svg in tab view

    The SVG support does have a way to show part of a single SVG image by ID:

    void QSvgRenderer::render ( QPainter * painter, const QString & elementId, const QRectF & bounds = QRectF() )

    I have used this in anger to render user-selected parts of form templates. You have to be a little careful of the limits to Qt SVG support though (SVG Tiny) with wrapped text elements for example.

  4. The following user says thank you to ChrisW67 for this useful post:

    Lykurg (26th July 2010)

  5. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: represent svg in tab view

    Quote Originally Posted by ChrisW67 View Post
    The SVG support does have a way to show part of a single SVG image by ID:
    Great, I wasn't aware of that.

  6. #5
    Join Date
    Jul 2010
    Posts
    25
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: represent svg in tab view

    Thank you ChrisW67,
    I am new to Qt and do not know much about it. If my understanding is correct, then I will have to convert the image formed in the painter into a widget to represent it in the tab widget. Or will it be represented directly?

  7. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: represent svg in tab view

    You will have to paint the SVG sub-set into a widget that is displayed on a tab. You can render() using any Qt QPainter so there is more than one way to do it (oops slipped into Perl mode there). You might like to put a QLabel on each tab, render into a QPixmap (by creating a QPainter with the pixmap as the paint device), and then call QLabel::setPixmap().

Similar Threads

  1. Replies: 8
    Last Post: 6th May 2010, 11:17
  2. Replies: 5
    Last Post: 3rd April 2010, 04:07
  3. how to represent a graph?
    By harakiri in forum Qt Programming
    Replies: 2
    Last Post: 4th August 2009, 14:37
  4. Replies: 5
    Last Post: 21st November 2007, 20:38
  5. Model-view: Creating a custom view
    By taboom in forum Qt Programming
    Replies: 5
    Last Post: 17th August 2007, 20:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.