summaryrefslogtreecommitdiff
path: root/examples/bluetooth/heartrate-game/deviceinfo.cpp
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2023-03-27 11:46:33 +0200
committerIvan Solovev <ivan.solovev@qt.io>2023-03-28 14:44:16 +0200
commita1f43b9dcd722527d52ceb0c7a138bd2994c1a7b (patch)
tree827d2ee2e5e3a1edaec5b8ce7c4089d45ac3163b /examples/bluetooth/heartrate-game/deviceinfo.cpp
parent6f155ca7df89c649e178dac57f69574290cb516b (diff)
downloadqtconnectivity-a1f43b9dcd722527d52ceb0c7a138bd2994c1a7b.tar.gz
HeartRate Game example: general clean-up
C++ code cleanup: * Fix include headers * Minor code-style improvements * Silence the warning about an uncreatable type by explicitly using QML_UNCREATABLE. We do not create the type in QML anyway. * Do not limit Windows platform to simulator mode. The example works perfectly on Windows. Build-system improvements: * Use qt_standard_project_setup() and PRIVATE linking in CMake Docs: * Add Connectivity category * Link to the documentation page which gives a full example overview Task-number: QTBUG-111972 Fixes: QTBUG-112194 Pick-to: 6.5 6.5.0 Change-Id: I6e50d1a3e9219afbf010d6471e8f7eb802c2ef00 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Diffstat (limited to 'examples/bluetooth/heartrate-game/deviceinfo.cpp')
-rw-r--r--examples/bluetooth/heartrate-game/deviceinfo.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/examples/bluetooth/heartrate-game/deviceinfo.cpp b/examples/bluetooth/heartrate-game/deviceinfo.cpp
index e34d0993..55dcf0e8 100644
--- a/examples/bluetooth/heartrate-game/deviceinfo.cpp
+++ b/examples/bluetooth/heartrate-game/deviceinfo.cpp
@@ -1,11 +1,13 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-#include "heartrate-global.h"
#include "deviceinfo.h"
+#include "heartrate-global.h"
+
+#include <QtBluetooth/qbluetoothaddress.h>
+#include <QtBluetooth/qbluetoothuuid.h>
-#include <QBluetoothAddress>
-#include <QBluetoothUuid>
+using namespace Qt::StringLiterals;
DeviceInfo::DeviceInfo(const QBluetoothDeviceInfo &info):
m_device(info)
@@ -20,14 +22,14 @@ QBluetoothDeviceInfo DeviceInfo::getDevice() const
QString DeviceInfo::getName() const
{
if (simulator)
- return "Demo device";
+ return u"Demo device"_s;
return m_device.name();
}
QString DeviceInfo::getAddress() const
{
if (simulator)
- return "00:11:22:33:44:55";
+ return u"00:11:22:33:44:55"_s;
#ifdef Q_OS_DARWIN
// workaround for Core Bluetooth:
return m_device.deviceUuid().toString();