Qt 4.7: SVG Viewer Example

Qt Reference Documentation

# SVG Viewer Example

Files:

- painting/svgviewer/mainwindow.cpp
- painting/svgviewer/mainwindow.h
- painting/svgviewer/svgview.cpp
- painting/svgviewer/svgview.h
- painting/svgviewer/files/bubbles.svg
- painting/svgviewer/files/cubic.svg
- painting/svgviewer/files/spheres.svg
- painting/svgviewer/main.cpp
- painting/svgviewer/svgviewer.pro
- painting/svgviewer/svgviewer.qrc

The SVG Viewer example shows how to add SVG viewing support to applications.

Scalable Vector Graphics (SVG) is an XML-based language for describing two-dimensional vector graphics. Qt provides classes for rendering and displaying SVG drawings in widgets and on other paint devices. This example allows the user to load SVG files and view them in a QGraphicsView using a QGraphicsSvgItem. Based on the selected renderer the QGraphicsView uses either a QWidget or QGLWidget as its viewport. A third render mode is also provided, where the QGraphicsView draws indirectly though a QImage. This allows testing of drawing accuracy and performance for both the native, raster, and OpenGL paint engines.

See the QtSvg module documentation for more information about SVG and Qt's SVG classes.