| CMakeLists.txt |
|
994 |
- |
| qgraphicssvgitem.cpp |
!
\class QGraphicsSvgItem
\inmodule QtSvgWidgets
\ingroup graphicsview-api
\brief The QGraphicsSvgItem class is a QGraphicsItem that can be used to render
the contents of SVG files.
\since 4.2
QGraphicsSvgItem provides a way of rendering SVG files onto QGraphicsView.
QGraphicsSvgItem can be created by passing the SVG file to be rendered to
its constructor or by explicit setting a shared QSvgRenderer on it.
Note that setting QSvgRenderer on a QGraphicsSvgItem doesn't make the item take
ownership of the renderer, therefore if using setSharedRenderer() method one has
to make sure that the lifetime of the QSvgRenderer object will be at least as long
as that of the QGraphicsSvgItem.
QGraphicsSvgItem provides a way of rendering only parts of the SVG files via
the setElementId. If setElementId() method is called, only the SVG element
(and its children) with the passed id will be renderer. This provides a convenient
way of selectively rendering large SVG files that contain a number of discrete
elements. For example the following code renders only jokers from a SVG file
containing a whole card deck:
\snippet src_svg_qgraphicssvgitem.cpp 0
Size of the item can be set via direct manipulation of the items
transformation matrix.
By default the SVG rendering is cached using QGraphicsItem::DeviceCoordinateCache
mode to speedup the display of items. Caching can be disabled by passing
QGraphicsItem::NoCache to the QGraphicsItem::setCacheMode() method.
\sa QSvgWidget, {Qt SVG C++ Classes}, QGraphicsItem, QGraphicsView
|
8371 |
- |
| qgraphicssvgitem.h |
|
1707 |
- |
| qsvgwidget.cpp |
!
\class QSvgWidget
\inmodule QtSvgWidgets
\ingroup painting
\brief The QSvgWidget class provides a widget that is used to display the contents of
Scalable Vector Graphics (SVG) files.
\since 4.1
This class enables developers to display SVG drawings alongside standard widgets, and
is used in much the same way as QLabel is used for displaying text and bitmap images.
Since QSvgWidget is a subclass of QWidget, SVG drawings are rendered using the properties
of the display. More control can be exercised over the rendering process with the
QSvgRenderer class, as this can be used to paint onto other paint devices, such as QImage
and QGLWidget. The renderer used by the widget can be obtained with the renderer()
function.
Each QSvgWidget can be constructed with the file name of a SVG file, or they can be
constructed without a specific file to render and one can be supplied later. The load()
functions provide two different ways to load an SVG file: they accept either the file name
of an SVG file or a QByteArray containing the serialized XML representation of an SVG file.
By default, the widget provides a size hint to reflect the size of the drawing that it
displays. If no data has been loaded, the widget provides the default QWidget size hint.
Subclass this class and reimplement sizeHint() if you need to customize this behavior.
\sa QSvgRenderer, {Qt SVG C++ Classes}, QPicture
|
5377 |
- |
| qsvgwidget.h |
|
1037 |
- |
| qtsvgwidgetsglobal.h |
|
366 |
- |