PDA

View Full Version : How to add SVG file at tab widget(Tab1) ??



lichang
23rd May 2019, 11:09
I make a tab widget and have 2 tabs.
I want to show a SVG file at tab1.
How could I offser SVG file add into the tab1's graphics View ??

d_stranz
23rd May 2019, 16:42
QSvgGraphicsItem and QSvgWidget are not the same. If all you want to do it display an SVG file in a widget by itself on a tab, use QSvgWidget. If you want a QGraphicsScene that includes other QGraphicsItem types in addition to the SVG item, then you will use the Qt Graphics/View subsystem to build the scene and display it in your view.

If all you want is simple SVG display, then replace the QGraphicsView in your mainwindow.ui with QSvgWidget.