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
qwaylandcompositorquickextensions_p.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QWAYLANDCOMPOSITORQUICKEXTENSIONS_P_H
6#define QWAYLANDCOMPOSITORQUICKEXTENSIONS_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQml/qqml.h>
20#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
21#include <QtWaylandCompositor/qwaylandquickextension.h>
22
23#include <QtWaylandCompositor/qwaylandcompositor.h>
24#include <QtWaylandCompositor/qwaylandquickcompositor.h>
25#include <QtWaylandCompositor/qwaylandqtwindowmanager.h>
26#include <QtWaylandCompositor/qwaylandtextinputmanager.h>
27#include <QtCore/private/qglobal_p.h>
28#include <QtWaylandCompositor/qwaylandtextinputmanagerv3.h>
29#include <QtWaylandCompositor/qwaylandqttextinputmethodmanager.h>
30#include <QtWaylandCompositor/qwaylandidleinhibitv1.h>
31
33
35{
36 Q_OBJECT
37 Q_PROPERTY(QQmlListProperty<QWaylandCompositorExtension> extensions READ extensions)
38 Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
39 Q_CLASSINFO("DefaultProperty", "data")
40 QML_NAMED_ELEMENT(WaylandCompositor)
41 QML_ADDED_IN_VERSION(1, 0)
42public:
43 QQmlListProperty<QObject> data()
44 {
45 return QQmlListProperty<QObject>(this, &m_objects);
46 }
47
48 QQmlListProperty<QWaylandCompositorExtension> extensions()
49 {
50 return QQmlListProperty<QWaylandCompositorExtension>(this, this,
51 &append_extension,
52 &countFunction,
53 &atFunction,
54 &clearFunction);
55 }
56
57 static qsizetype countFunction(QQmlListProperty<QWaylandCompositorExtension> *list)
58 {
59 return static_cast<QWaylandQuickCompositorQuickExtensionContainer *>(list->data)->extension_vector.size();
60 }
61
62 static QWaylandCompositorExtension *atFunction(QQmlListProperty<QWaylandCompositorExtension> *list, qsizetype index)
63 {
64 return static_cast<QWaylandQuickCompositorQuickExtensionContainer *>(list->data)->extension_vector.at(index);
65 }
66
67 static void append_extension(QQmlListProperty<QWaylandCompositorExtension> *list, QWaylandCompositorExtension *extension)
68 {
69 QWaylandQuickCompositorQuickExtensionContainer *quickExtObj = static_cast<QWaylandQuickCompositorQuickExtensionContainer *>(list->data);
70 extension->setExtensionContainer(quickExtObj);
71 }
72
73 static void clearFunction(QQmlListProperty<QWaylandCompositorExtension> *list)
74 {
75 static_cast<QWaylandQuickCompositorQuickExtensionContainer *>(list->data)->extension_vector.clear();
76 }
77
78private:
79 QList<QObject *> m_objects;
80};
81
82
83// Note: These have to be in a header with a Q_OBJECT macro, otherwise we won't run moc on it
84Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(QWaylandQtWindowManager, QtWindowManager, 1, 0)
85Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(QWaylandIdleInhibitManagerV1,
86 IdleInhibitManagerV1, 1, 0)
87Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(QWaylandTextInputManager, TextInputManager, 1, 0)
88Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(QWaylandTextInputManagerV3, TextInputManagerV3,
89 1, 0)
90Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(QWaylandQtTextInputMethodManager,
91 QtTextInputMethodManager, 1, 0)
92
93QT_END_NAMESPACE
94
95#endif // QWAYLANDCOMPOSITORQUICKEXTENSIONS_P_H