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
qwaylandoutput.h
Go to the documentation of this file.
1// Copyright (C) 2017-2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
2// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6#ifndef QWAYLANDOUTPUT_H
7#define QWAYLANDOUTPUT_H
8
9#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
10#include <QtWaylandCompositor/qwaylandcompositorextension.h>
11#include <QtWaylandCompositor/QWaylandOutputMode>
12#include <QtCore/QObject>
13#include <QtCore/QRect>
14#include <QtCore/QSize>
15
16struct wl_resource;
17
18QT_BEGIN_NAMESPACE
19
20class QWaylandOutputPrivate;
21class QWaylandCompositor;
22class QWindow;
23class QWaylandSurface;
24class QWaylandView;
25class QWaylandClient;
26
27class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandOutput : public QWaylandObject
28{
29 Q_OBJECT
30 Q_DECLARE_PRIVATE(QWaylandOutput)
31 Q_PROPERTY(QWaylandCompositor *compositor READ compositor WRITE setCompositor NOTIFY compositorChanged)
32 Q_PROPERTY(QWindow *window READ window WRITE setWindow NOTIFY windowChanged)
33 Q_PROPERTY(QString manufacturer READ manufacturer WRITE setManufacturer NOTIFY manufacturerChanged)
34 Q_PROPERTY(QString model READ model WRITE setModel NOTIFY modelChanged)
35 Q_PROPERTY(QPoint position READ position WRITE setPosition NOTIFY positionChanged)
36 Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
37 Q_PROPERTY(QRect availableGeometry READ availableGeometry WRITE setAvailableGeometry NOTIFY availableGeometryChanged)
38 Q_PROPERTY(QSize physicalSize READ physicalSize WRITE setPhysicalSize NOTIFY physicalSizeChanged)
39 Q_PROPERTY(QWaylandOutput::Subpixel subpixel READ subpixel WRITE setSubpixel NOTIFY subpixelChanged)
40 Q_PROPERTY(QWaylandOutput::Transform transform READ transform WRITE setTransform NOTIFY transformChanged)
41 Q_PROPERTY(int scaleFactor READ scaleFactor WRITE setScaleFactor NOTIFY scaleFactorChanged)
42 Q_PROPERTY(bool sizeFollowsWindow READ sizeFollowsWindow WRITE setSizeFollowsWindow NOTIFY sizeFollowsWindowChanged)
43
44 QML_NAMED_ELEMENT(WaylandOutputBase)
45 QML_ADDED_IN_VERSION(1, 0)
46 QML_UNCREATABLE("Cannot create instance of WaylandOutputBase, use WaylandOutput instead")
47public:
48 enum Subpixel {
49 SubpixelUnknown = 0,
50 SubpixelNone,
51 SubpixelHorizontalRgb,
52 SubpixelHorizontalBgr,
53 SubpixelVerticalRgb,
54 SubpixelVerticalBgr
55 };
56 Q_ENUM(Subpixel)
57
58 enum Transform {
59 TransformNormal = 0,
60 Transform90,
61 Transform180,
62 Transform270,
63 TransformFlipped,
64 TransformFlipped90,
65 TransformFlipped180,
66 TransformFlipped270
67 };
68 Q_ENUM(Transform)
69
70 QWaylandOutput();
71 QWaylandOutput(QWaylandCompositor *compositor, QWindow *window);
72 ~QWaylandOutput() override;
73
74 static QWaylandOutput *fromResource(wl_resource *resource);
75 struct ::wl_resource *resourceForClient(QWaylandClient *client) const;
76
77 QWaylandCompositor *compositor() const;
78 void setCompositor(QWaylandCompositor *compositor);
79
80 QWindow *window() const;
81 void setWindow(QWindow *window);
82
83 QString manufacturer() const;
84 void setManufacturer(const QString &manufacturer);
85
86 QString model() const;
87 void setModel(const QString &model);
88
89 QPoint position() const;
90 void setPosition(const QPoint &pt);
91
92 QList<QWaylandOutputMode> modes() const;
93
94 void addMode(const QWaylandOutputMode &mode, bool preferred = false);
95
96 QWaylandOutputMode currentMode() const;
97 void setCurrentMode(const QWaylandOutputMode &mode);
98
99 QRect geometry() const;
100
101 QRect availableGeometry() const;
102 void setAvailableGeometry(const QRect &availableGeometry);
103
104 QSize physicalSize() const;
105 void setPhysicalSize(const QSize &size);
106
107 Subpixel subpixel() const;
108 void setSubpixel(const Subpixel &subpixel);
109
110 Transform transform() const;
111 void setTransform(const Transform &transform);
112
113 int scaleFactor() const;
114 void setScaleFactor(int scale);
115
116 bool sizeFollowsWindow() const;
117 void setSizeFollowsWindow(bool follow);
118
119 bool physicalSizeFollowsSize() const;
120 void setPhysicalSizeFollowsSize(bool follow);
121
122 void frameStarted();
123 void sendFrameCallbacks();
124
125 void surfaceEnter(QWaylandSurface *surface);
126 void surfaceLeave(QWaylandSurface *surface);
127
128 virtual void update();
129
130Q_SIGNALS:
131 void compositorChanged();
132 void windowChanged();
133 void positionChanged();
134 void geometryChanged();
135 void modeAdded();
136 void currentModeChanged();
137 void availableGeometryChanged();
138 void physicalSizeChanged();
139 void scaleFactorChanged();
140 void subpixelChanged();
141 void transformChanged();
142 void sizeFollowsWindowChanged();
143 void physicalSizeFollowsSizeChanged();
144 void manufacturerChanged();
145 void modelChanged();
146 void windowDestroyed();
147
148protected:
149 bool event(QEvent *event) override;
150
151 virtual void initialize();
152
153private:
154 Q_PRIVATE_SLOT(d_func(), void _q_handleMaybeWindowPixelSizeChanged())
155 Q_PRIVATE_SLOT(d_func(), void _q_handleWindowDestroyed())
156};
157
158QT_END_NAMESPACE
159
160#endif // QWAYLANDOUTPUT_H
\qmltype WaylandOutput \nativetype QWaylandOutput \inqmlmodule QtWayland.Compositor
Combined button and popup list for selecting options.
static QtWaylandServer::wl_output::transform toWlTransform(const QWaylandOutput::Transform &value)
static QT_BEGIN_NAMESPACE QtWaylandServer::wl_output::subpixel toWlSubpixel(const QWaylandOutput::Subpixel &value)