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
qeglfsemulatorscreen.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
7
8using namespace Qt::StringLiterals;
9
11 : QEglFSScreen(eglGetDisplay(EGL_DEFAULT_DISPLAY))
12 , m_id(0)
13{
14 initFromJsonObject(screenDescription);
15}
16
18{
19 return m_geometry;
20}
21
23{
24 return QRect(QPoint(0, 0), m_geometry.size());
25}
26
28{
29 return m_depth;
30}
31
33{
34 return m_format;
35}
36
38{
39 return m_physicalSize;
40}
41
46
48{
49 return QDpi(100, 100);
50}
51
53{
54 return m_refreshRate;
55}
56
58{
59 return m_nativeOrientation;
60}
61
63{
64 return m_orientation;
65}
66
68{
69 return m_id;
70}
71
73{
74 return m_description;
75}
76
77void QEglFSEmulatorScreen::initFromJsonObject(const QJsonObject &description)
78{
80
81 value = description.value("id"_L1);
82 if (!value.isUndefined() && value.isDouble())
83 m_id = value.toInt();
84
85 value = description.value("description"_L1);
86 if (!value.isUndefined() && value.isString())
87 m_description = value.toString();
88
89 value = description.value("geometry"_L1);
90 if (!value.isUndefined() && value.isObject()) {
91 QJsonObject geometryObject = value.toObject();
92 value = geometryObject.value("x"_L1);
93 if (!value.isUndefined() && value.isDouble())
94 m_geometry.setX(value.toInt());
95 value = geometryObject.value("y"_L1);
96 if (!value.isUndefined() && value.isDouble())
97 m_geometry.setY(value.toInt());
98 value = geometryObject.value("width"_L1);
99 if (!value.isUndefined() && value.isDouble())
100 m_geometry.setWidth(value.toInt());
101 value = geometryObject.value("height"_L1);
102 if (!value.isUndefined() && value.isDouble())
103 m_geometry.setHeight(value.toInt());
104 }
105
106 value = description.value("depth"_L1);
107 if (!value.isUndefined() && value.isDouble())
108 m_depth = value.toInt();
109
110 value = description.value("format"_L1);
111 if (!value.isUndefined() && value.isDouble())
112 m_format = static_cast<QImage::Format>(value.toInt());
113
114 value = description.value("physicalSize"_L1);
115 if (!value.isUndefined() && value.isObject()) {
116 QJsonObject physicalSizeObject = value.toObject();
117 value = physicalSizeObject.value("width"_L1);
118 if (!value.isUndefined() && value.isDouble())
119 m_physicalSize.setWidth(value.toInt());
120 value = physicalSizeObject.value("height"_L1);
121 if (!value.isUndefined() && value.isDouble())
122 m_physicalSize.setHeight(value.toInt());
123 }
124
125
126 value = description.value("refreshRate"_L1);
127 if (!value.isUndefined() && value.isDouble())
128 m_refreshRate = value.toDouble();
129
130 value = description.value("nativeOrientation"_L1);
131 if (!value.isUndefined() && value.isDouble())
132 m_nativeOrientation = static_cast<Qt::ScreenOrientation>(value.toInt());
133
134 value = description.value("orientation"_L1);
135 if (!value.isUndefined() && value.isDouble())
136 m_orientation = static_cast<Qt::ScreenOrientation>(value.toInt());
137}
138
QSizeF physicalSize() const override
Reimplement this function in subclass to return the physical size of the screen, in millimeters.
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
int depth() const override
Reimplement in subclass to return current depth of the screen.
qreal refreshRate() const override
Reimplement this function in subclass to return the vertical refresh rate of the screen,...
QDpi logicalBaseDpi() const override
Reimplement to return the base logical DPI for the platform.
Qt::ScreenOrientation orientation() const override
Reimplement this function in subclass to return the current orientation of the screen,...
Qt::ScreenOrientation nativeOrientation() const override
Reimplement this function in subclass to return the native orientation of the screen,...
QString name() const override
QDpi logicalDpi() const override
Reimplement this function in subclass to return the logical horizontal and vertical dots per inch met...
QImage::Format format() const override
Reimplement in subclass to return the image format which corresponds to the screen format.
QRect rawGeometry() const override
QEglFSEmulatorScreen(const QJsonObject &screenDescription)
Format
The following image formats are available in Qt.
Definition qimage.h:41
\inmodule QtCore\reentrant
Definition qjsonobject.h:20
QJsonValue value(const QString &key) const
Returns a QJsonValue representing the value for the key key.
\inmodule QtCore\reentrant
Definition qjsonvalue.h:25
double toDouble(double defaultValue=0) const
Converts the value to a double and returns it.
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr void setWidth(int w) noexcept
Sets the width of the rectangle to the given width.
Definition qrect.h:381
constexpr void setX(int x) noexcept
Sets the left edge of the rectangle to the given x coordinate.
Definition qrect.h:215
constexpr QSize size() const noexcept
Returns the size of the rectangle.
Definition qrect.h:242
constexpr void setHeight(int h) noexcept
Sets the height of the rectangle to the given height.
Definition qrect.h:384
constexpr void setY(int y) noexcept
Sets the top edge of the rectangle to the given y coordinate.
Definition qrect.h:218
\inmodule QtCore
Definition qsize.h:208
constexpr void setHeight(qreal h) noexcept
Sets the height to the given finite height.
Definition qsize.h:341
constexpr void setWidth(qreal w) noexcept
Sets the width to the given finite width.
Definition qsize.h:338
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
ScreenOrientation
Definition qnamespace.h:271
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
QPair< qreal, qreal > QDpi
unsigned int uint
Definition qtypes.h:34
double qreal
Definition qtypes.h:187