How to open svg file like png file. For example it works for png file:
scene=new QGraphicsScene(QRect(10, 10, 680, 520));
view=new QGraphicsView(this);
image=new QGraphicsPixmapItem(QPixmap("example.png"));
scene ->addItem(image);
view ->setScene(scene);
view ->setGeometry(QRect(270, 35, 700, 540));
Any ideas?
As per my comment, you could use QGraphicsSvgItem as per documentation:
So, you would basically write something as follows:
You can also follow th example in the documentation if you wish to use it with the
QSvgRenderer.Here you can even find a more sophisticated example of doing this:
SVG Viewer Example