Fix potential detaches when iterating over QMap::values()
Found by the Axivion code analyzer.
The obvious fix could be to store the result of var.values() calls
in a local const variable. However, we can do even better and avoid
creating a temporary list of values, because QMap::const_iterator
iterates over values.
As a result, drop the .values() calls and wrap the member variables
into std::as_const() to avoid potential detaches. Also add a comment
that mentions the behavior of QMap::const_iterator.
Axivion-Id: qt_Add-ons_qtbluetooth_dev_linux:SV215
Axivion-Id: qt_Add-ons_qtbluetooth_dev_linux:SV216
Task-number: QTBUG-144754
Pick-to: 6.11 6.8
Change-Id: I9c334d8cf8c874805e71662e69cc03b627154722
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>