Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickshadereffectsource_p.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 QQUICKSHADEREFFECTSOURCE_P_H
5#define QQUICKSHADEREFFECTSOURCE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick/private/qtquickglobal_p.h>
19
20QT_REQUIRE_CONFIG(quick_shadereffect);
21
22#include "qquickitem.h"
23#include <QtQuick/qsgtextureprovider.h>
24#include <private/qsgadaptationlayer_p.h>
25#include <QtQuick/private/qsgcontext_p.h>
26#include <private/qsgdefaultinternalimagenode_p.h>
27#include <private/qquickitemchangelistener_p.h>
28
29#include "qpointer.h"
30#include "qsize.h"
31#include "qrect.h"
32
34
35class QSGNode;
36class UpdatePaintNodeData;
39
41
42class Q_QUICK_PRIVATE_EXPORT QQuickShaderEffectSource : public QQuickItem, public QQuickItemChangeListener
43{
45 Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged FINAL)
46 Q_PROPERTY(QQuickItem *sourceItem READ sourceItem WRITE setSourceItem NOTIFY sourceItemChanged FINAL)
47 Q_PROPERTY(QRectF sourceRect READ sourceRect WRITE setSourceRect NOTIFY sourceRectChanged FINAL)
48 Q_PROPERTY(QSize textureSize READ textureSize WRITE setTextureSize NOTIFY textureSizeChanged FINAL)
49 Q_PROPERTY(Format format READ format WRITE setFormat NOTIFY formatChanged FINAL)
50 Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged FINAL)
51 Q_PROPERTY(bool hideSource READ hideSource WRITE setHideSource NOTIFY hideSourceChanged FINAL)
52 Q_PROPERTY(bool mipmap READ mipmap WRITE setMipmap NOTIFY mipmapChanged FINAL)
53 Q_PROPERTY(bool recursive READ recursive WRITE setRecursive NOTIFY recursiveChanged FINAL)
54 Q_PROPERTY(TextureMirroring textureMirroring READ textureMirroring WRITE setTextureMirroring NOTIFY textureMirroringChanged REVISION(2, 6) FINAL)
55 Q_PROPERTY(int samples READ samples WRITE setSamples NOTIFY samplesChanged REVISION(2, 9) FINAL)
56 QML_NAMED_ELEMENT(ShaderEffectSource)
58
59public:
60 enum WrapMode {
64 Repeat
65 };
66 Q_ENUM(WrapMode)
67
68 enum Format {
69 RGBA8 = 1,
72
73 // Qt 5 legacy values that were ignored starting from Qt 6.0
74 Alpha = RGBA8,
75 RGB = RGBA8,
76 RGBA = RGBA8
77 };
79
81 NoMirroring = 0x00,
82 MirrorHorizontally = 0x01,
83 MirrorVertically = 0x02
84 };
85 Q_ENUM(TextureMirroring)
86
89
90 WrapMode wrapMode() const;
91 void setWrapMode(WrapMode mode);
92
93 QQuickItem *sourceItem() const;
94 void setSourceItem(QQuickItem *item);
95
96 QRectF sourceRect() const;
97 void setSourceRect(const QRectF &rect);
98
99 QSize textureSize() const;
100 void setTextureSize(const QSize &size);
101
102 Format format() const;
103 void setFormat(Format format);
104
105 bool live() const;
106 void setLive(bool live);
107
108 bool hideSource() const;
109 void setHideSource(bool hide);
110
111 bool mipmap() const;
112 void setMipmap(bool enabled);
113
114 bool recursive() const;
115 void setRecursive(bool enabled);
116
117 TextureMirroring textureMirroring() const;
118 void setTextureMirroring(TextureMirroring mirroring);
119
120 bool isTextureProvider() const override { return true; }
121 QSGTextureProvider *textureProvider() const override;
122
123 Q_INVOKABLE void scheduleUpdate();
124
125 int samples() const;
126 void setSamples(int count);
127
140
142
143private Q_SLOTS:
144 void sourceItemDestroyed(QObject *item);
145 void invalidateSceneGraph();
146
147protected:
148 void releaseResources() override;
150
151 void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &) override;
152 void itemChange(ItemChange change, const ItemChangeData &value) override;
153
154private:
155 void ensureTexture();
156
158 QSGLayer *m_texture;
159 WrapMode m_wrapMode;
160 QQuickItem *m_sourceItem;
161 QRectF m_sourceRect;
162 QSize m_textureSize;
163 Format m_format;
164 int m_samples;
165 uint m_live : 1;
166 uint m_hideSource : 1;
167 uint m_mipmap : 1;
168 uint m_recursive : 1;
169 uint m_grab : 1;
170 uint m_textureMirroring : 2; // Stores TextureMirroring enum
171};
172
174
175#endif // QQUICKSHADEREFFECTSOURCE_P_H
\inmodule QtCore
Definition qobject.h:90
The QOpenGLFramebufferObject class encapsulates an OpenGL framebuffer object.
virtual void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:64
virtual QSGNode * updatePaintNode(QSGNode *, UpdatePaintNodeData *)
Called on the render thread when it is time to sync the state of the item with the scene graph.
virtual QSGTextureProvider * textureProvider() const
Returns the texture provider for an item.
virtual void itemChange(ItemChange, const ItemChangeData &)
Called when change occurs for this item.
virtual void releaseResources()
This function is called when an item should release graphics resources which are not already managed ...
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
Definition qquickitem.h:143
bool isTextureProvider() const override
Returns true if this item is a texture provider.
\inmodule QtCore\reentrant
Definition qrect.h:483
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
The QSGSimpleRectNode class is a convenience class for drawing solid filled rectangles using scenegra...
The QSGTextureProvider class encapsulates texture based entities in QML.
\inmodule QtCore
Definition qsize.h:25
Format
Definition ddsheader.h:14
widget setFormat(format)
rect
[4]
Combined button and popup list for selecting options.
@ Alpha
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
@ Repeat
GLsizei samples
GLenum mode
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei GLsizei GLenum format
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INVOKABLE
#define Q_SLOTS
#define Q_SIGNALS
unsigned int uint
Definition qtypes.h:29
QGraphicsItem * item
edit hide()
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent
\inmodule QtQuick
Definition qquickitem.h:158