Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qgraphicssvgitem.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QGRAPHICSSVGITEM_H
6#define QGRAPHICSSVGITEM_H
7
8#include <QtSvgWidgets/qtsvgwidgetsglobal.h>
9
10#if !defined(QT_NO_GRAPHICSVIEW)
11
12#include <QtWidgets/qgraphicsitem.h>
13
14QT_BEGIN_NAMESPACE
15
16
17class QSvgRenderer;
19
20class Q_SVGWIDGETS_EXPORT QGraphicsSvgItem : public QGraphicsObject
21{
22 Q_OBJECT
23 Q_INTERFACES(QGraphicsItem)
24 Q_PROPERTY(QString elementId READ elementId WRITE setElementId)
25 Q_PROPERTY(QSize maximumCacheSize READ maximumCacheSize WRITE setMaximumCacheSize)
26
27public:
28 QGraphicsSvgItem(QGraphicsItem *parentItem = nullptr);
29 QGraphicsSvgItem(const QString &fileName, QGraphicsItem *parentItem = nullptr);
30 ~QGraphicsSvgItem() override;
31
32 void setSharedRenderer(QSvgRenderer *renderer);
33 QSvgRenderer *renderer() const;
34
35 void setElementId(const QString &id);
36 QString elementId() const;
37
38 void setCachingEnabled(bool);
39 bool isCachingEnabled() const;
40
41 void setMaximumCacheSize(const QSize &size);
42 QSize maximumCacheSize() const;
43
44 QRectF boundingRect() const override;
45
46 void paint(QPainter *painter,
47 const QStyleOptionGraphicsItem *option,
48 QWidget *widget = nullptr) override;
49
50 enum { Type = 13 };
51 int type() const override;
52
53private:
54 Q_DISABLE_COPY(QGraphicsSvgItem)
55 Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QGraphicsSvgItem)
56
57 Q_PRIVATE_SLOT(d_func(), void _q_repaintItem())
58};
59
60QT_END_NAMESPACE
61
62#endif // QT_NO_GRAPHICSVIEW
63
64#endif // QGRAPHICSSVGITEM_H
\inmodule QtSvgWidgets
Combined button and popup list for selecting options.