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
qquick3dxrruntimeinfo.cpp
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4
#
include
"qquick3dxrruntimeinfo_p.h"
5
#
include
"qquick3dxrmanager_p.h"
6
#
include
<
QtQuick
/
QQuickWindow
>
7
#
include
<
rhi
/
qrhi
.
h
>
8
9
#
if
defined
(
Q_OS_VISIONOS
)
10
#
include
"visionos/qquick3dxrmanager_visionos_p.h"
11
#
else
12
#
include
"openxr/qquick3dxrmanager_openxr_p.h"
13
#
endif
14
15
QT_BEGIN_NAMESPACE
16
17
/*!
18
\qmltype XrRuntimeInfo
19
\inherits Item
20
\inqmlmodule QtQuick3D.Xr
21
\brief Displays information about the XR runtime.
22
23
This type provides information about the XR runtime, including enabled
24
extensions, runtime name, version, graphics API name, and whether multi-view
25
rendering is supported.
26
27
\note This type is automatically created by an \l XrView, and it can not be
28
manually created.
29
*/
30
31
QQuick3DXrRuntimeInfo::QQuick3DXrRuntimeInfo(QQuick3DXrManager *manager, QObject *parent)
32
: QObject(parent),
33
m_xrmanager(manager)
34
{
35
}
36
37
/*!
38
\qmlproperty list<string> XrRuntimeInfo::enabledExtensions
39
\brief A list of enabled XR extensions.
40
\readonly
41
42
This property holds a QStringList containing the names of the
43
XR extensions that are currently enabled for the runtime.
44
45
\note This list may vary depending on the runtime implementation and can be
46
empty.
47
*/
48
49
QStringList QQuick3DXrRuntimeInfo::enabledExtensions()
const
50
{
51
QQuick3DXrManagerPrivate *manager = QQuick3DXrManagerPrivate::get(m_xrmanager);
52
return
manager ? manager->enabledExtensions() : QStringList{};
53
}
54
55
/*!
56
\qmlproperty string XrRuntimeInfo::runtimeName
57
\brief The name of the XR runtime.
58
\readonly
59
60
This property provides the human-readable name of the XR runtime being
61
used.
62
*/
63
64
QString QQuick3DXrRuntimeInfo::runtimeName()
const
65
{
66
QQuick3DXrManagerPrivate *manager = QQuick3DXrManagerPrivate::get(m_xrmanager);
67
return
manager ? manager->runtimeName() : QString{};
68
}
69
70
/*!
71
\qmlproperty string XrRuntimeInfo::runtimeVersion
72
\brief The version of the XR runtime.
73
\readonly
74
75
This property holds the version string of the XR runtime
76
(for example, "1.0.0").
77
*/
78
79
QString QQuick3DXrRuntimeInfo::runtimeVersion()
const
80
{
81
QQuick3DXrManagerPrivate *manager = QQuick3DXrManagerPrivate::get(m_xrmanager);
82
return
manager ? manager->runtimeVersion().toString() : QString{};
83
}
84
85
/*!
86
\qmlproperty string XrRuntimeInfo::graphicsApiName
87
\brief The name of the graphics API used by the XR runtime.
88
\readonly
89
90
This property holds the name of the graphics API (for example, "Vulkan") that the
91
XR runtime is utilizing.
92
*/
93
94
QString QQuick3DXrRuntimeInfo::graphicsApiName()
const
95
{
96
// This matches what Qt Quick's GraphicsInfo would expose to QML, but that
97
// does not provide a string. We have seen way too many switch statements
98
// in JS for this. So, have a string property here and call it a day.
99
if
(m_xrmanager->isValid() && m_xrmanager->m_quickWindow) {
100
QRhi *rhi = m_xrmanager->m_quickWindow->rhi();
101
if
(rhi)
102
return
QString::fromLatin1(rhi->backendName());
103
}
104
return
QLatin1String(
"Unknown"
);
105
}
106
107
QT_END_NAMESPACE
QPlatformGraphicsBufferHelper
\inmodule QtGui
qtquick3d
src
xr
quick3dxr
qquick3dxrruntimeinfo.cpp
Generated on
for Qt by
1.14.0