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
31 void setSharedRenderer(QSvgRenderer *renderer);
32 QSvgRenderer *renderer() const;
33
34 void setElementId(const QString &id);
35 QString elementId() const;
36
37 void setCachingEnabled(bool);
38 bool isCachingEnabled() const;
39
40 void setMaximumCacheSize(const QSize &size);
41 QSize maximumCacheSize() const;
42
43 QRectF boundingRect() const override;
44
45 void paint(QPainter *painter,
46 const QStyleOptionGraphicsItem *option,
47 QWidget *widget = nullptr) override;
48
49 enum { Type = 13 };
50 int type() const override;
51
52private:
53 Q_DISABLE_COPY(QGraphicsSvgItem)
54 Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QGraphicsSvgItem)
55
56 Q_PRIVATE_SLOT(d_func(), void _q_repaintItem())
57};
58
59QT_END_NAMESPACE
60
61#endif // QT_NO_GRAPHICSVIEW
62
63#endif // QGRAPHICSSVGITEM_H
\inmodule QtSvgWidgets
Combined button and popup list for selecting options.