Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qwasmplatform.cpp
Go to the documentation of this file.
1
// Copyright (C) 2022 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
#
include
"qwasmplatform.h"
6
7
QT_BEGIN_NAMESPACE
8
9
Platform
platform
()
10
{
11
static
const
Platform qtDetectedPlatform = ([]() {
12
// The Platform Detect: expand coverage as needed
13
emscripten::val rawPlatform = emscripten::val::global(
"navigator"
)[
"platform"
];
14
15
if
(rawPlatform.call<
bool
>(
"includes"
, emscripten::val(
"Mac"
)))
16
return
Platform::MacOS;
17
if
(rawPlatform.call<
bool
>(
"includes"
, emscripten::val(
"iPhone"
))
18
|| rawPlatform.call<
bool
>(
"includes"
, emscripten::val(
"iPad"
)))
19
return
Platform::iOS;
20
if
(rawPlatform.call<
bool
>(
"includes"
, emscripten::val(
"Win32"
)))
21
return
Platform::Windows;
22
if
(rawPlatform.call<
bool
>(
"includes"
, emscripten::val(
"Linux"
))) {
23
emscripten::val uAgent = emscripten::val::global(
"navigator"
)[
"userAgent"
];
24
if
(uAgent.call<
bool
>(
"includes"
, emscripten::val(
"Android"
)))
25
return
Platform::Android;
26
return
Platform::Linux;
27
}
28
return
Platform::Generic;
29
})();
30
return
qtDetectedPlatform;
31
}
32
33
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
platform
QT_BEGIN_NAMESPACE Platform platform()
Definition
qwasmplatform.cpp:9
qtbase
src
plugins
platforms
wasm
qwasmplatform.cpp
Generated on
for Qt by
1.18.0