Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwaylandquickitem_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QWAYLANDQUICKITEM_P_H
5#define QWAYLANDQUICKITEM_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/qquickitem_p.h>
19#include <QtQuick/QSGMaterialShader>
20#include <QtQuick/QSGMaterial>
21
22#include <QtWaylandCompositor/QWaylandQuickItem>
23#include <QtWaylandCompositor/QWaylandOutput>
24
26
28class QMutex;
29class QOpenGLTexture;
30
31#if QT_CONFIG(opengl)
32class QWaylandBufferMaterialShader : public QSGMaterialShader
33{
34public:
35 QWaylandBufferMaterialShader(QWaylandBufferRef::BufferFormatEgl format);
36
37 bool updateUniformData(RenderState &state,
38 QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
39 void updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
40 QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
41 void setupExternalOESShader(const QString &shaderFilename);
42};
43
44class QWaylandBufferMaterial : public QSGMaterial
45{
46public:
47 QWaylandBufferMaterial(QWaylandBufferRef::BufferFormatEgl format);
48 ~QWaylandBufferMaterial() override;
49
50 void setTextureForPlane(int plane, QOpenGLTexture *texture, QSGTexture *scenegraphTexture);
51 void setBufferRef(QWaylandQuickItem *surfaceItem, const QWaylandBufferRef &ref);
52
53 void bind();
54 void updateScenegraphTextures(QRhi *rhi);
55
56 QSGMaterialType *type() const override;
58
59private:
60 friend QWaylandBufferMaterialShader;
61
62 void setTextureParameters(GLenum target);
63 void ensureTextures(int count);
64
67 QVarLengthArray<QSGTexture*, 3> m_scenegraphTextures;
68 QWaylandBufferRef m_bufferRef;
69};
70#endif // QT_CONFIG(opengl)
71
73{
74 Q_DECLARE_PUBLIC(QWaylandQuickItem)
75public:
77
78 void init()
79 {
81 if (!mutex)
82 mutex = new QMutex;
83
86
87 q->update();
88
89 q->setSmooth(true);
90
92 QObject::connect(q, &QQuickItem::windowChanged, q, &QWaylandQuickItem::updateWindow);
94 QObject::connect(view.data(), &QWaylandView::surfaceChanged, q, &QWaylandQuickItem::handleSurfaceChanged);
97 QObject::connect(view.data(), &QWaylandView::outputChanged, q, &QWaylandQuickItem::updateOutput);
100
101 q->updateWindow();
102 }
103
104 static const QWaylandQuickItemPrivate* get(const QWaylandQuickItem *item) { return item->d_func(); }
105
107 {
109 q->setAcceptedMouseButtons(enable ? (Qt::LeftButton | Qt::MiddleButton | Qt::RightButton |
114 q->setAcceptTouchEvents(enable);
115 q->setAcceptHoverEvents(enable);
117 }
118
120 qreal scaleFactor() const;
121
125 void placeAboveParent();
126 void placeBelowParent();
127
128 virtual void raise();
129 virtual void lower();
130
131 static QMutex *mutex;
132
137 bool paintEnabled = true;
140 bool isDragging = false;
141 bool newTexture = false;
142 bool focusOnClick = true;
143 bool belowParent = false;
144#if QT_CONFIG(opengl)
145 bool paintByProvider = false;
146#endif
149
155};
156
158
159#endif /*QWAYLANDQUICKITEM_P_H*/
Definition qlist.h:74
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
\inmodule QtCore Represents a handle to a signal-slot (or signal-functor) connection.
\inmodule QtCore
Definition qmutex.h:285
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2823
\inmodule QtGui
\inmodule QtCore\reentrant
Definition qpoint.h:214
\inmodule QtCore
Definition qpointer.h:18
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
\inmodule QtGui
Definition qrhi.h:1767
The QSGMaterialShader class represents a graphics API independent shader program.
virtual bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
This function is called by the scene graph to get the contents of the shader program's uniform buffer...
virtual void updateSampledImage(RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
This function is called by the scene graph to prepare use of sampled images in the shader,...
The QSGMaterial class encapsulates rendering state for a shader program.
Definition qsgmaterial.h:15
virtual QSGMaterialShader * createShader(QSGRendererInterface::RenderMode renderMode) const =0
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
virtual QSGMaterialType * type() const =0
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
RenderMode
\value RenderMode2D Normal 2D rendering \value RenderMode2DNoDepthBuffer Normal 2D rendering with dep...
\inmodule QtQuick
Definition qsgtexture.h:20
\inmodule QtCore
T * data() const noexcept
Returns the value of the pointer referenced by this object.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtWaylandCompositor
\qmltype WaylandOutput \instantiates QWaylandOutput \inqmlmodule QtWayland.Compositor
QWaylandQuickItem * findSibling(QWaylandSurface *surface) const
void setInputEventsEnabled(bool enable)
QWaylandSurface::Origin origin
QScopedPointer< QWaylandView > view
QPointer< QObject > subsurfaceHandler
QMetaObject::Connection texProviderConnection
void placeBelowSibling(QWaylandQuickItem *sibling)
void placeAboveSibling(QWaylandQuickItem *sibling)
QWaylandSurfaceTextureProvider * provider
QList< QWaylandSeat * > touchingSeats
QWaylandQuickItemPrivate()=default
static const QWaylandQuickItemPrivate * get(const QWaylandQuickItem *item)
QPointer< QWaylandSurface > oldSurface
\qmltype WaylandQuickItem \instantiates QWaylandQuickItem \inqmlmodule QtWayland.Compositor
bool allowDiscardFrontBuffer
By default, the item locks the current buffer until a new buffer is available and updatePaintNode() i...
void surfaceDestroyed()
\qmlsignal void QtWayland.Compositor::WaylandQuickItem::surfaceDestroyed()
void bufferLockedChanged()
\qmltype WaylandSurface \instantiates QWaylandSurface \inqmlmodule QtWayland.Compositor
Origin
This enum type is used to specify the origin of a QWaylandSurface's buffer.
\qmltype WaylandView \instantiates QWaylandView \inqmlmodule QtWayland.Compositor
void surfaceDestroyed()
void allowDiscardFrontBufferChanged()
QWaylandSurface * surface
\qmlproperty WaylandSurface QtWayland.Compositor::WaylandView::surface
void bufferLockedChanged()
void outputChanged()
void surfaceChanged()
else opt state
[0]
Combined button and popup list for selecting options.
@ ExtraButton9
Definition qnamespace.h:73
@ LeftButton
Definition qnamespace.h:57
@ ExtraButton5
Definition qnamespace.h:69
@ ExtraButton6
Definition qnamespace.h:70
@ RightButton
Definition qnamespace.h:58
@ ExtraButton12
Definition qnamespace.h:76
@ ExtraButton10
Definition qnamespace.h:74
@ MiddleButton
Definition qnamespace.h:59
@ ExtraButton2
Definition qnamespace.h:65
@ ExtraButton1
Definition qnamespace.h:62
@ ExtraButton11
Definition qnamespace.h:75
@ ExtraButton13
Definition qnamespace.h:77
@ NoButton
Definition qnamespace.h:56
@ ExtraButton8
Definition qnamespace.h:72
@ ExtraButton3
Definition qnamespace.h:67
@ ExtraButton7
Definition qnamespace.h:71
@ ExtraButton4
Definition qnamespace.h:68
GLenum GLenum GLsizei count
typedef GLenum(GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC)(void)
GLenum target
GLboolean enable
GLenum GLuint texture
GLint ref
GLint GLsizei GLsizei GLenum format
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
double qreal
Definition qtypes.h:92
QGraphicsItem * item
socketLayer bind(QHostAddress::Any, 4000)
The QSGMaterialType class is used as a unique type token in combination with QSGMaterial.