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
qwaylandshellsurface.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6
7/*!
8 * \class QWaylandShellSurfaceTemplate
9 * \inmodule QtWaylandCompositor
10 * \since 5.8
11 * \brief QWaylandShellSurfaceTemplate is a convenience class for creating custom shell surface
12 * classes.
13 *
14 * QWaylandShellSurfaceTemplate is a template class which inherits from QWaylandShellSurface and
15 * is convenience for building custom shell extensions.
16 *
17 * It provides the connection between Qt Wayland Compositor and the class generated by
18 * \c qtwaylandscanner, based on the XML description of the extension protocol.
19 *
20 * It provides two specific pieces of convenience:
21 * \list
22 * \li A reimplementation of \l{QWaylandCompositorExtension::extensionInterface()} which returns
23 * the \c wl_interface pointer for the qtwaylandscanner-generated base class.
24 * \li A static \l{findIn()} function which searches for an instance of the extension in a
25 * provided container, and returns this if it is found.
26 * \endlist
27 *
28 * The same usage pattern applies as for QWaylandCompositorExtensionTemplate, with \a T
29 * being the subclass itself.
30 *
31 * \sa { Custom Shell}
32 */
33
34/*!
35 * \fn template <typename T> T *QWaylandShellSurfaceTemplate<T>::findIn(QWaylandObject *container)
36 *
37 * If any instance of the interface has been registered with \a container, this is returned.
38 * Otherwise null is returned. The look-up is based on the generated \c interfaceName() which
39 * matches the interface name in the protocol description.
40 */
41
42
43/*!
44 * \qmltype ShellSurface
45 * \nativetype QWaylandShellSurface
46 * \inqmlmodule QtWayland.Compositor
47 * \since 5.8
48 * \brief Provides a common interface for surface roles specified by shell extensions.
49 *
50 * This interface represents a Wayland surface role given by a Wayland protocol extension that
51 * defines how the WaylandSurface should map onto the screen.
52 *
53 * \note Even though this type contains a very limited API, the properties and signals of the
54 * implementations are named consistently. For example, if you're only using desktop shell
55 * extensions in your compositor, it's safe to access properties such as title, maximized, etc.
56 * directly on the ShellSurface. See the various implementations for additional properties and
57 * signals.
58 *
59 * \sa WaylandSurface, ShellSurfaceItem, XdgSurface, IviSurface, WlShellSurface
60 */
61
62/*!
63 * \class QWaylandShellSurface
64 * \inmodule QtWaylandCompositor
65 * \since 5.8
66 * \brief The QWaylandShellSurface class is a common interface for surface roles specified by shell extensions.
67 *
68 * This interface represents a Wayland surface role given by a Wayland protocol extension that
69 * defines how the QWaylandSurface should map onto the screen.
70 *
71 * \sa QWaylandSurface, QWaylandXdgSurface, QWaylandIviSurface, QWaylandWlShellSurface, QWaylandShellSurfaceTemplate
72 */
73
74#if QT_CONFIG(wayland_compositor_quick)
75/*!
76 * \fn QWaylandQuickShellIntegration *QWaylandShellSurface::createIntegration(QWaylandQuickShellSurfaceItem *item)
77 *
78 * Creates a QWaylandQuickShellIntegration for this QWaylandQuickShellSurface. It's called
79 * automatically when \a {item}'s \l {QWaylandQuickShellSurfaceItem::}{shellSurface} is assigned.
80 *
81 * \sa QWaylandQuickShellSurfaceItem
82 */
83#endif
84
85/*!
86 * \qmlproperty enum QtWayland.Compositor::ShellSurface::windowType
87 *
88 * This property holds the \l{Qt::WindowType}{window type} of the ShellSurface.
89 */
90
91/*!
92 * \property QWaylandShellSurface::windowType
93 *
94 * This property holds the \l{Qt::WindowType}{window type} of the QWaylandShellSurface.
95 */
96
97/*!
98 * \qmlproperty bool QtWayland.Compositor::ShellSurface::modal
99 *
100 * This property is true if the ShellSurface represents a modal dialog.
101 * \since 6.8
102 */
103
104/*!
105 * \property QWaylandShellSurface::modal
106 *
107 * This property is true if the ShellSurface represents a modal dialog.
108 * \since 6.8
109 */
110
112
113QWaylandShellSurface::QWaylandShellSurface(QWaylandShellSurfacePrivate &dd)
114 : QWaylandCompositorExtension(dd)
115{
116}
117
118QWaylandShellSurface::QWaylandShellSurface(QWaylandObject *container, QWaylandShellSurfacePrivate &dd)
119 : QWaylandCompositorExtension(container, dd)
120{
121}
122
123QWaylandShellSurface::QWaylandShellSurface(QWaylandObject *waylandObject)
124 : QWaylandCompositorExtension(waylandObject, *new QWaylandShellSurfacePrivate)
125{
126}
127
128bool QWaylandShellSurface::isModal() const
129{
130 Q_D(const QWaylandShellSurface);
131 return d->modal;
132}
133
134void QWaylandShellSurface::setModal(bool newModal)
135{
136 Q_D(QWaylandShellSurface);
137 if (d->modal == newModal)
138 return;
139 d->modal = newModal;
140 emit modalChanged();
141}
142
143QT_END_NAMESPACE
144
145#include "moc_qwaylandshellsurface.cpp"
Combined button and popup list for selecting options.