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
qwaylandquickitem.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 QWAYLANDSURFACEITEM_H
5#define QWAYLANDSURFACEITEM_H
6
7#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
8
9#include <QtQuick/QQuickItem>
10#include <QtQuick/qsgtexture.h>
11
12#include <QtQuick/qsgtextureprovider.h>
13
14#include <QtWaylandCompositor/qwaylandview.h>
15#include <QtWaylandCompositor/qwaylandquicksurface.h>
16
18
19QT_REQUIRE_CONFIG(wayland_compositor_quick);
20
22
23class QWaylandSeat;
25
26class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickItem : public QQuickItem
27{
29 Q_DECLARE_PRIVATE(QWaylandQuickItem)
30 Q_PROPERTY(QWaylandCompositor *compositor READ compositor NOTIFY compositorChanged)
31 Q_PROPERTY(QWaylandSurface *surface READ surface WRITE setSurface NOTIFY surfaceChanged)
32 Q_PROPERTY(bool paintEnabled READ isPaintEnabled WRITE setPaintEnabled NOTIFY paintEnabledChanged)
33 Q_PROPERTY(bool touchEventsEnabled READ touchEventsEnabled WRITE setTouchEventsEnabled NOTIFY touchEventsEnabledChanged)
34 Q_PROPERTY(QWaylandSurface::Origin origin READ origin NOTIFY originChanged)
35 Q_PROPERTY(bool inputEventsEnabled READ inputEventsEnabled WRITE setInputEventsEnabled NOTIFY inputEventsEnabledChanged)
36 Q_PROPERTY(bool focusOnClick READ focusOnClick WRITE setFocusOnClick NOTIFY focusOnClickChanged)
37 Q_PROPERTY(QObject *subsurfaceHandler READ subsurfaceHandler WRITE setSubsurfaceHandler NOTIFY subsurfaceHandlerChanged)
38 Q_PROPERTY(QWaylandOutput *output READ output WRITE setOutput NOTIFY outputChanged)
39 Q_PROPERTY(bool bufferLocked READ isBufferLocked WRITE setBufferLocked NOTIFY bufferLockedChanged)
40 Q_PROPERTY(bool allowDiscardFrontBuffer READ allowDiscardFrontBuffer WRITE setAllowDiscardFrontBuffer NOTIFY allowDiscardFrontBufferChanged)
41 Q_MOC_INCLUDE("qwaylandcompositor.h")
42 Q_MOC_INCLUDE("qwaylandseat.h")
43 Q_MOC_INCLUDE("qwaylanddrag.h")
44 QML_NAMED_ELEMENT(WaylandQuickItem)
46public:
47 QWaylandQuickItem(QQuickItem *parent = nullptr);
48 ~QWaylandQuickItem() override;
49
51 QWaylandView *view() const;
52
53 QWaylandSurface *surface() const;
54 void setSurface(QWaylandSurface *surface);
55
56 QWaylandSurface::Origin origin() const;
57
58 bool isTextureProvider() const override;
59 QSGTextureProvider *textureProvider() const override;
60
61 bool isPaintEnabled() const;
62 bool touchEventsEnabled() const;
63
64 void setTouchEventsEnabled(bool enabled);
65
66 bool inputEventsEnabled() const;
67 void setInputEventsEnabled(bool enabled);
68
69 bool focusOnClick() const;
70 void setFocusOnClick(bool focus);
71
72 bool inputRegionContains(const QPointF &localPosition) const;
73 Q_INVOKABLE QPointF mapToSurface(const QPointF &point) const;
74 Q_REVISION(1, 13) Q_INVOKABLE QPointF mapFromSurface(const QPointF &point) const;
75
76#if QT_CONFIG(im)
77 QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
79#endif
80
81 QObject *subsurfaceHandler() const;
82 void setSubsurfaceHandler(QObject*);
83
84 QWaylandOutput *output() const;
85 void setOutput(QWaylandOutput *output);
86
87 bool isBufferLocked() const;
88 void setBufferLocked(bool locked);
89
90 bool allowDiscardFrontBuffer() const;
91 void setAllowDiscardFrontBuffer(bool discard);
92
93 Q_INVOKABLE void setPrimary();
94
95protected:
96 void mousePressEvent(QMouseEvent *event) override;
97 void mouseMoveEvent(QMouseEvent *event) override;
98 void mouseReleaseEvent(QMouseEvent *event) override;
99 void hoverEnterEvent(QHoverEvent *event) override;
100 void hoverMoveEvent(QHoverEvent *event) override;
101 void hoverLeaveEvent(QHoverEvent *event) override;
102#if QT_CONFIG(wheelevent)
103 void wheelEvent(QWheelEvent *event) override;
104#endif
105
106 void keyPressEvent(QKeyEvent *event) override;
107 void keyReleaseEvent(QKeyEvent *event) override;
108
109 void touchEvent(QTouchEvent *event) override;
110 void touchUngrabEvent() override;
111
112#if QT_CONFIG(im)
113 void inputMethodEvent(QInputMethodEvent *event) override;
114#endif
115
116 virtual void surfaceChangedEvent(QWaylandSurface *newSurface, QWaylandSurface *oldSurface);
117public Q_SLOTS:
118 virtual void takeFocus(QWaylandSeat *device = nullptr);
119 void setPaintEnabled(bool paintEnabled);
120 void raise();
121 void lower();
122 void sendMouseMoveEvent(const QPointF &position, QWaylandSeat *seat = nullptr);
123
124private Q_SLOTS:
125 void surfaceMappedChanged();
126 void handleSurfaceChanged();
127 void parentChanged(QWaylandSurface *newParent, QWaylandSurface *oldParent);
128 void updateSize();
129 void updateBuffer(bool hasBuffer);
130 void updateWindow();
131 void updateOutput();
132 void beforeSync();
133 void handleSubsurfaceAdded(QWaylandSurface *childSurface);
134 void handleSubsurfacePosition(const QPoint &pos);
135 void handlePlaceAbove(QWaylandSurface *referenceSurface);
136 void handlePlaceBelow(QWaylandSurface *referenceSurface);
137#if QT_CONFIG(draganddrop)
138 void handleDragStarted(QWaylandDrag *drag);
139#endif
140#if QT_CONFIG(im)
141 void updateInputMethod(Qt::InputMethodQueries queries);
142#endif
143 void updateFocus();
144
154 void mouseMove(const QPointF &windowPosition);
160protected:
161 QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override;
162
164};
165
167
168#endif
static void updateWindow(JNIEnv *, jobject)
IOBluetoothDevice * device
\inmodule QtGui
Definition qevent.h:246
The QInputMethodEvent class provides parameters for input method events.
Definition qevent.h:625
The QKeyEvent class describes a key event.
Definition qevent.h:424
\inmodule QtGui
Definition qevent.h:196
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore\reentrant
Definition qpoint.h:217
\inmodule QtCore\reentrant
Definition qpoint.h:25
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
The QSGTextureProvider class encapsulates texture based entities in QML.
The QTouchEvent class contains parameters that describe a touch event.
Definition qevent.h:917
\inmodule QtCore
Definition qvariant.h:65
\qmltype WaylandCompositor \instantiates QWaylandCompositor \inqmlmodule QtWayland....
\qmltype WaylandOutput \instantiates QWaylandOutput \inqmlmodule QtWayland.Compositor
\qmltype WaylandQuickItem \instantiates QWaylandQuickItem \inqmlmodule QtWayland.Compositor
void allowDiscardFrontBufferChanged()
void compositorChanged()
void touchEventsEnabledChanged()
void inputEventsEnabledChanged()
void paintEnabledChanged()
void subsurfaceHandlerChanged()
void focusOnClickChanged()
void mouseMove(const QPointF &windowPosition)
void surfaceDestroyed()
\qmlsignal void QtWayland.Compositor::WaylandQuickItem::surfaceDestroyed()
void bufferLockedChanged()
\qmltype WaylandSeat \instantiates QWaylandSeat \inqmlmodule QtWayland.Compositor
\qmltype WaylandSurface \instantiates QWaylandSurface \inqmlmodule QtWayland.Compositor
\qmltype WaylandView \instantiates QWaylandView \inqmlmodule QtWayland.Compositor
bool focus
[0]
Combined button and popup list for selecting options.
InputMethodQuery
#define Q_DECLARE_METATYPE(TYPE)
Definition qmetatype.h:1525
static QOpenGLCompositor * compositor
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLfloat GLfloat GLfloat GLfloat h
struct _cl_event * event
GLenum query
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_INVOKABLE
#define Q_SLOTS
#define Q_MOC_INCLUDE(...)
#define Q_SIGNALS
QT_BEGIN_NAMESPACE typedef uchar * output
QQuickView * view
[0]
QDBusArgument argument