Fix detaches in ranged-for with rvalue containers
Found by Axivion code analyzer.
In all cases, the containers are returned by value from const
getters. We cannot simply wrap the getters into std::as_const(),
because the returned values are rvalues, and they cannot be passed
to as_const.
As a result, we need to introduce const temporary local variables. They
will increase the ref count to 2, similarly to directly calling the
getters inside the ranged-for, but after that the loops will use const
iterators, thus preventing unwanted detaches.
As a drive-by: fix the coding style by putting the '&' near the
variable, not the type. Also, add missing whitespaces around ':'.
Axivion-Id: qt_Add-ons_qtbluetooth_dev_linux:SV204
Axivion-Id: qt_Add-ons_qtbluetooth_dev_linux:SV205
Axivion-Id: qt_Add-ons_qtbluetooth_dev_linux:SV206
Axivion-Id: qt_Add-ons_qtbluetooth_dev_linux:SV207
Axivion-Id: qt_Add-ons_qtbluetooth_dev_linux:SV210
Axivion-Id: qt_Add-ons_qtbluetooth_dev_linux:SV211
Axivion-Id: qt_Add-ons_qtbluetooth_dev_linux:SV213
Axivion-Id: qt_Add-ons_qtbluetooth_dev_linux:SV214
Task-number: QTBUG-144754
Pick-to: 6.11 6.8
Change-Id: I39d2b6583de6b8befdbc4064b432ac07682d3e9f
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>