Windows: Move WinRT hresult_error guard macros to a shared header


The SAFE/HR/TRY/LOG_HRESULT macros that wrap C++/WinRT projection
accessors so a thrown winrt::hresult_error becomes a logged HRESULT
plus a default-constructed return value were defined locally in
qlowenergycontroller_winrt.cpp. The same pattern is needed in other
WinRT bluetooth backend files, so move the definitions into
qbluetoothutils_winrt_p.h, which the affected sources already include.

The unified SAFE() branches on std::is_default_constructible: types
that are default-constructible (primitives, enums, winrt::hstring,
generic interfaces like IAsyncOperation<T> whose nullptr_t constructor
has a default argument) get decltype(x){} on the failure path, while
runtimeclass projections that only declare an explicit
Class(std::nullptr_t) constructor fall back to decltype(x)(nullptr).
The old form decltype(x)(0) reached the second group via the null-
pointer-constant conversion to nullptr_t but failed for winrt::hstring
whose nullptr_t constructor is deleted; a naive decltype(x){} failed
for the runtimeclass projections.

Pick-to: 6.11 6.8
Task-number: QTBUG-145898
Change-Id: I0e2b59bacb551748bf27f7ac74e810f8fdbb005e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
commit80b628514cf40009d81a7dfaf1580615135f83e4
parent92f0ab78acc1b5cd6fdf0b5ab654e48d32b814b3
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>
commit timeMon, 4 May 2026 14:13:59 +0000