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
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
4
#include "
qwasmplatform.h
"
5
6
QT_BEGIN_NAMESPACE
7
8
Platform
platform
()
9
{
10
static
const
Platform
qtDetectedPlatform = ([]() {
11
// The Platform Detect: expand coverage as needed
12
emscripten::val rawPlatform = emscripten::val::global(
"navigator"
)[
"platform"
];
13
14
if
(rawPlatform.call<
bool
>(
"includes"
, emscripten::val(
"Mac"
)))
15
return
Platform::MacOS
;
16
if
(rawPlatform.call<
bool
>(
"includes"
, emscripten::val(
"iPhone"
))
17
|| rawPlatform.call<
bool
>(
"includes"
, emscripten::val(
"iPad"
)))
18
return
Platform::iOS
;
19
if
(rawPlatform.call<
bool
>(
"includes"
, emscripten::val(
"Win32"
)))
20
return
Platform::Windows
;
21
if
(rawPlatform.call<
bool
>(
"includes"
, emscripten::val(
"Linux"
))) {
22
emscripten::val uAgent = emscripten::val::global(
"navigator"
)[
"userAgent"
];
23
if
(uAgent.call<
bool
>(
"includes"
, emscripten::val(
"Android"
)))
24
return
Platform::Android
;
25
return
Platform::Linux
;
26
}
27
return
Platform::Generic
;
28
})();
29
return
qtDetectedPlatform;
30
}
31
32
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1590
platform
QT_BEGIN_NAMESPACE Platform platform()
Definition
qwasmplatform.cpp:8
qwasmplatform.h
Platform
Platform
Definition
qwasmplatform.h:16
Platform::MacOS
@ MacOS
Platform::iOS
@ iOS
Platform::Generic
@ Generic
Platform::Windows
@ Windows
Platform::Android
@ Android
Platform::Linux
@ Linux
qtbase
src
plugins
platforms
wasm
qwasmplatform.cpp
Generated by
1.10.0