The count() methods on QByteArray and QString are deprecated. The ones
on other Qt containers will likely follow soon, so port them all to
size().
The changes which also require int -> qsizetype will come in a
follow-up patch.
Pick-to: 6.3
Change-Id: I23e364019b9cfc457d93f4a3bb4660fe8d790da8
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
- Remove automatic use of CMAKE_AUTORCC
- Only opt into CMAKE_AUTOUIC if .ui files are involved
- Remove explicit setting of CMAKE_INCLUDE_CURRENT_DIR
- Combine multiple find_package(Qt6 ... calls)
- use REQUIRED COMPONENTS
- sort components alphabetically
- Fix wrong indentations
- Use (only) one empty line after multi-line commands
Pick-to: 6.3
Change-Id: If1935beb09edd873c45842ae06d0f41267a9b36a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit guards against creating multiple client sockets if multiple
services are found. In addition the service scanning is stopped when
a service has been found and we start connecting a bluetooth socket.
Fixes: QTBUG-100289
Pick-to: 5.15 6.2 6.3
Change-Id: Iac2e7eaca17a186ac2d2f62e338be16911f08032
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The m_timer and m_serverInfo instances are created using 'this' as a
parent, so we do not need to explicitly delete them in the destructor,
but let the parent object deal with them.
This also prevents a crash at application close.
Pick-to: 6.3 6.2 5.15
Change-Id: If91f01e1ab6dc8e839a06773464eeb9858d2fd36
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
The service info returned by the QBluetoothServer::listen() overload
that returns it needs to be stored or otherwise it will be destroyed.
The consequence was that the SDP "advertisement" didn't properly
include the added pingpong service record on Windows.
Task-number: QTBUG-100042
Pick-to: 6.2 6.3 5.15
Change-Id: I79cbd0f574e35bbc1c9c3123ce8382f3aad296d4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
The example was assuming that QBluetoothLocalDevice::allDevices() always
returns a non-empty list.
This is not true for the cases when desktop has no bluetooth adapters,
as well as for WinRT implementation (it always returns empty list for now).
This patch fixes the crash and provides some information messages to the
console. Note that WinRT implementation has an extended warning, because
it returns an empty list even if the adapter actually exists.
Fixes: QTBUG-98323
Pick-to: 6.2
Change-Id: Iaa81465cf6be2febf20526c11909667fd60728b3
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
The default generated Info.plist is not enough as the Bluetooth examples
require NSBluetoothAlwaysUsageDescription key to work. Without this
patch on macOS 12 there are two possible outcomes:
1) If the example is built with qmake, the application will crash
and the crash report will indicate that the key is missing
2) If the example is built with CMake, the application will not start
as it tries to use iOS specific .plist file
The patch uses absolute paths in the example CMakeLists.txt files
to work around a Ninja bug:
https://gitlab.kitware.com/cmake/cmake/-/issues/20181
Using relative paths resulted in "multiple rules generate" errors
if the QtConnectivity module is built with examples.
Note that the plist files are only effective if the application is
started as an app bundle, ie. not if launching the contained binary
directly.
Pick-to: 6.2
Task-number: QTBUG-98090
Change-Id: Iedb7eabbb8fde6ad1ba14ada1a7ee87ec1d708ba
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
As per Qt documentation in
https://doc.qt.io/qt-5/qml-qtquick-listview.html#example-usage
the parent of a delegate can change and be 'null' at times.
This commit refers explicitly to the containing view instead.
Change-Id: I9c9a8c907daba2b6de52a246ae71cfde0c27e55b
Fixes: QTBUG-97691
Pick-to: 6.2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
- Use Qt 5 connection syntax
- Use a QDialogButtonBox instead of a single button in the service dialog
- Forward-declare the UI classes
- Streamline code
Pick-to: 6.2
Change-Id: I30db78043a8e3a62ea10223252a59b8415296e55
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
The QML View was created on heap and outlived the 'device'
context property on stack. This resulted in distracting
'null' property access errors on exit.
In addition remove unnecessary QML import versioning.
Pick-to: 6.2
Change-Id: I5cb7d219582ef8e9a72a3f7e514e78fb16a54e2f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
btscanner example can be built and deployed on iOS, but then it requires
special entries in its Info.plist, explaining the usage of BT adapter.
Pick-to: 6.2 5.15
Change-Id: I86edfe84a19f4da8173bb5374fb10e55811a4b20
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Our lowenergyscanner example can be built and deployed on iOS device.
As such, it has to provide an explanation, why it needs an access to
BT adapter, otherwise, it would crash with the most recent versions
of iOS.
Pick-to: 6.2 5.15
Change-Id: Iebcdf8af931002532aada0c452263effd342300e
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Apple (iOS) requires a "proper" Info.plist entries, explaining _why_
we want to use Bluetooth on this particular device. So, let's add it.
Both the server and game apps need it.
Fixes: QTBUG-93991
Pick-to: 5.15 6.2
Change-Id: I09133c6714f30bc402049cd40969a9b9644a0b4f
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Because of a name clash, a wrong image was shown in the
documentation of the QML pingpong example. This patch changes the
filename to prevent the name clash.
Fixes: QTBUG-94192
Change-Id: I4e27b4b9a05efe9c1766a256305ead16a09fa9c7
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The low timeout of five seconds leads to lots of frustration.
This patch extends to 25 seconds, which is most of the time
long enough.
Pick-to: 6.2
Change-Id: I2157ac0e794011a65e306dd7451e35e1bc0e7c8d
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
See qtscxml/examples/statemachine/statemachine/pingpong for reference
Fixes: QTBUG-92985
Change-Id: I00c2cb39d0f72be0790e55ce31419c5883b34e32
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In the future, discoverDetails() should become optional.
The state of a QLowEnergyService after its creation should have
a name which does not imply it is not functional yet. This patch
changes the name of the initial state from "DiscoveryRequired"
to the neutral "RemoteService".
Task-number: QTBUG-75340
Change-Id: Ib407e60f5fc7264a04a124561dacbcebb01bf252
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Currently, there is a name clash between the error getter and
the error signal. This leads to extensive use of qOverload or
similar. This patch renames all error signals to errorOccurred
to resolve this.
Task-number: QTBUG-62877
Change-Id: I615e2405f855433b6e142d820072c4d3f35ae28f
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
QBluetoothSocket enum values were tied to QAbstractSocket enum values.
But there is no dependency, the coupling is not required. This patch
removes the coupling and changes to scoped enums for improved type
safety.
Task-number: QTBUG-62877
Change-Id: I206b1d438d74b976d3e0d32da5713d22b597dd90
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
QBluetoothUuid contains enums for ProtocolUuid, ServiceClassUuid,
CharacteristicType and DescriptorType. So far, they all
put their constants directly into the QBluetoothUuid
namespace, making it easy to mix them up. This patch changes
those to scoped enums. That way, each enum has its items in
its own namespace.
Change-Id: I86ea08ff31009dc8073d84cfe678e27920d693f7
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This patch updates the documentation of the pingpong example
to the changes made.
Change-Id: I4ebe3848b71a8edb61fd359a8d8d2af9c05494c8
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Game logic of the pingpong example was a bit boring, because the
angle of the ball never changed. This patch adds convex paddles.
The surface of the paddle is simulated to be a quarter of a circle.
Also, in each reflection, the speed of the ball increases.
Change-Id: I208e7322f2b4b849118d98959a6076458d20f409
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
To play again, it was necessary to restart the whole executable.
This patch restarts the game at the end so that players can keep
playing.
Change-Id: I593a57862d449631d8f93b7d8e3cb56314f4fedd
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
The two parties playing pingpong agreed on a screen size in the past.
This patch changes the logic to work on the unit square (0,1)x(0,1).
Visualization scales this up to window size. This patch also
simplifies the position update loop
Change-Id: Ie89b1eaa5fc14daf6b56cd42458a16ae0a923568
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
With this patch, the pingpong example no longer forces the
use of a 600x300 window on mobile devices, which led to a suboptimal
user experience.
Change-Id: I2365542bc8d5f99d015499f9b7e8c14ec5a93237
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
On some devices, it was hard to grab the paddles. This patch
enlarges the mousearea to easier grab the paddles.
Change-Id: I10d15b7605521d6a8d7775e5b6b96bce61e44de4
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This patch adds an extra rectangle to keep the playing area square.
Change-Id: I79a80c511eab8f0af44a98e5ff2ee74a88781fad
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Increase the ball by a factor of 2. Also remove NumberAnimation
which was not working anyway. Correct radius.
Change-Id: I4f0e5d50a7eb192a0743533f35e77809be77186a
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reorganize code to have graphical elements and event handlers
separated
Change-Id: I64480649e7bf077b0e63193250a4cb0fe6be699d
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This patch changes the paddle radius to be half of its width.
This way, the shape is independent of the size of the window.
Change-Id: I1a959293e7cab0fdf320e879f828592b2b3b5f1a
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This patch removes the BluetoothDiscoveryModel,
QDeclarativeBluetoothService, and QDeclarativeBluetoothSocket.
It also removes the "scanner" example and the "chat" example,
both using BluetoothDiscoveryModel.
Fixes: QTBUG-75354
Task-number: QTBUG-62877
Change-Id: Id9f6a75330e81c97ae9cd3fcaec793d0224ce72b
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Missing reference in range-for with non trivial type (QBluetoothDeviceInfo)
Change-Id: I6f2e3092054376fdc52acdbeba149fe1a02b88fe
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
This patch removes QBluetoothTransferManager,
QBluetoothTransferReply and QBluetoothTransferRequest.
Furthermore, the examples "btfiletransfer" and "picturetransfer"
are removed.
Fixes: QTBUG-75353
Task-number: QTBUG-62877
Change-Id: Ife192d80196249185df877fb6a4cae317d7e44ad
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Documentation of the heartrate-game example stated that a demo
mode is used if no devices are available, which is untrue.
This patch corrects the documentation to state that a demo mode
can be activated with a compile-time switch, which is true.
Change-Id: Ia7b7e9f524f8bd3f9c341c74b73e119faf6ebdaa
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This patch streamlines all bluetooth examples to have
logging prepared, but not activated, in main().
Change-Id: Idbc81e2937c56acdc17c8fb81de2b8afe384608d
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Btchat example documentation mentioned a QRfcommServer where
a QBluetoothServer is created. This patch updates the documentation.
Change-Id: I1278a4c576aea8d5745dbb8405b1401a27d02146
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
The heartrate-server example links Qt::Gui on Android. But
Qt::Gui was not found using find_package. This patch adds
the missing find_package() call
Change-Id: I54e98f4959964c8730cdddda6ef8a6d4501ec866
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This patch fixes several warnings like
assets/Services.qml:81:5: QML Connections: Implicitly defined onFoo
properties in Connections are deprecated. Use this syntax instead:
function onFoo(<arguments>) { ... }
Change-Id: Ic4af8f2fc76e437f7b4113e691f2b2461b273bbb
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This patch fixes the warning
Injection of parameters into signal handlers is deprecated. Use
JavaScript functions with formal parameters instead.
Change-Id: Ibc8a0c3e1d8938a2da616303427df8f78dfa9aa2
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This patch fixes the error
qrc:/scanner.qml:122: TypeError: Cannot read property 'width' of null
Change-Id: I4d12403e790d2e5203bdbab0d31acef3016f2399
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This patch fixes the error
qml/Connect.qml:103: TypeError: Cannot read property 'width' of null
Change-Id: I6592d603eee21684460d133df5f37fbcc9bc4fc8
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>