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
qohospositioncommon.cpp
Go to the documentation of this file.
1// Copyright (C) 2025 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#include <QtCore/private/qohoscommon_p.h>
6#include <QtCore/qcoreapplication.h>
7#include <QtCore/qpermissions.h>
8
10
11QNapi::Object getGeoLocationManagerObject(QOhosJsState &jsState)
12{
13 return jsState.eval<QNapi::Object>("@ohos.geoLocationManager");
14}
15
17{
18 if (!qApp)
19 return false;
20
21 QLocationPermission perm;
22 return qApp->checkPermission(perm) == Qt::PermissionStatus::Granted;
23}
24
26 int timeoutMs, std::function<void()> timeoutCallback)
27{
28 auto timer = std::make_unique<QTimer>();
29 timer->setSingleShot(true);
30 timer->setInterval(timeoutMs);
31 QObject::connect(timer.get(), &QTimer::timeout, timer.get(), std::move(timeoutCallback));
32 timer->start();
33 return timer;
34}
35
36QT_END_NAMESPACE
Combined button and popup list for selecting options.
std::unique_ptr< QTimer > makeSingleShotUpdateTimeoutTimer(int timeoutMs, std::function< void()> timeoutCallback)
bool checkLocationOrApproximatelyLocationPermissionGranted()