blob: 8ed2e65245d0daac5c1ac00a142cf3137e0d1ebc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "device.h"
#include <QtCore/qloggingcategory.h>
#include <QtWidgets/qapplication.h>
#if QT_CONFIG(permissions)
#include <QtCore/qpermissions.h>
#endif
int main(int argc, char *argv[])
{
// QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
QApplication app(argc, argv);
DeviceDiscoveryDialog d;
d.show();
// Check, and if needed, request a permission to use Bluetooth.
#if QT_CONFIG(permissions)
const auto permissionStatus = app.checkPermission(QBluetoothPermission{});
if (permissionStatus == Qt::PermissionStatus::Undetermined) {
app.requestPermission(QBluetoothPermission{}, [](const QPermission &){
});
}
// Else means either 'Granted' or 'Denied' and both normally must be
// changed using the system's settings application.
#endif // QT_CONFIG(permissions)
return app.exec();
}
|