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