Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickpainteditem.h
Go to the documentation of this file.
1// Copyright (C) 2016 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
4#ifndef QQUICKPAINTEDITEM_P_H
5#define QQUICKPAINTEDITEM_P_H
6
7#include <QtQuick/qquickitem.h>
8#include <QtGui/qcolor.h>
9
11
13class Q_QUICK_EXPORT QQuickPaintedItem : public QQuickItem
14{
16
17 Q_PROPERTY(QSize contentsSize READ contentsSize WRITE setContentsSize NOTIFY contentsSizeChanged)
18 Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged)
19 Q_PROPERTY(qreal contentsScale READ contentsScale WRITE setContentsScale NOTIFY contentsScaleChanged)
20 Q_PROPERTY(RenderTarget renderTarget READ renderTarget WRITE setRenderTarget NOTIFY renderTargetChanged)
21 Q_PROPERTY(QSize textureSize READ textureSize WRITE setTextureSize NOTIFY textureSizeChanged)
22
23 QML_NAMED_ELEMENT(PaintedItem)
25 QML_UNCREATABLE("Cannot create instance of abstract class PaintedItem.")
26
27public:
28 explicit QQuickPaintedItem(QQuickItem *parent = nullptr);
29 ~QQuickPaintedItem() override;
30
34 InvertedYFramebufferObject
35 };
36 Q_ENUM(RenderTarget)
37
39 FastFBOResizing = 0x1
40 };
41 Q_DECLARE_FLAGS(PerformanceHints, PerformanceHint)
42 Q_FLAG(PerformanceHints)
43
44 void update(const QRect &rect = QRect());
45
46 bool opaquePainting() const;
47 void setOpaquePainting(bool opaque);
48
49 bool antialiasing() const;
50 void setAntialiasing(bool enable);
51
52 bool mipmap() const;
53 void setMipmap(bool enable);
54
55 PerformanceHints performanceHints() const;
56 void setPerformanceHint(PerformanceHint hint, bool enabled = true);
57 void setPerformanceHints(PerformanceHints hints);
58
59 QRectF contentsBoundingRect() const;
60
61 QSize contentsSize() const;
62 void setContentsSize(const QSize &);
63 void resetContentsSize();
64
65 qreal contentsScale() const;
66 void setContentsScale(qreal);
67
68 QSize textureSize() const;
69 void setTextureSize(const QSize &size);
70
71 QColor fillColor() const;
72 void setFillColor(const QColor&);
73
74 RenderTarget renderTarget() const;
75 void setRenderTarget(RenderTarget target);
76
77 virtual void paint(QPainter *painter) = 0;
78
79 bool isTextureProvider() const override;
80 QSGTextureProvider *textureProvider() const override;
81
88
89protected:
91 QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
92 void releaseResources() override;
93 void itemChange(ItemChange, const ItemChangeData &) override;
94
95private Q_SLOTS:
96 void invalidateSceneGraph();
97
98private:
99 Q_DISABLE_COPY(QQuickPaintedItem)
100 Q_DECLARE_PRIVATE(QQuickPaintedItem)
101};
102
103Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickPaintedItem::PerformanceHints)
104
106
107#endif // QQUICKPAINTEDITEM_P_H
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
Definition qquickitem.h:144
The QQuickPaintedItem class provides a way to use the QPainter API in the QML Scene Graph.
void contentsScaleChanged()
PerformanceHint
This enum describes flags that you can enable to improve rendering performance in QQuickPaintedItem.
virtual void paint(QPainter *painter)=0
This function, which is usually called by the QML Scene Graph, paints the contents of an item in loca...
void renderTargetChanged()
void textureSizeChanged()
RenderTarget
This enum describes QQuickPaintedItem's render targets.
void contentsSizeChanged()
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtCore\reentrant
Definition qrect.h:30
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
The QSGTextureProvider class encapsulates texture based entities in QML.
\inmodule QtCore
Definition qsize.h:25
rect
[4]
Combined button and popup list for selecting options.
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLenum target
GLboolean enable
#define QML_UNCREATABLE(REASON)
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_FLAG(x)
#define Q_SLOTS
#define Q_SIGNALS
double qreal
Definition qtypes.h:187
#define explicit
QPainter painter(this)
[7]
view create()
\inmodule QtQuick
Definition qquickitem.h:159