Details
-
Task
-
Resolution: Done
-
P3: Somewhat important
-
None
-
Windows [Phone] 8.1
-
-
6d95ce16493fbf819749dbd7ad9e8ffa61859cdb 164ae66ff763b39cfe921df96470c7bfd11038d2
Description
There is a lot of verbose COM handling in qtbase in WinRT code paths. We can simplify and make these calls more consistent by making some macros or inline functions in qfunctions_winrt.h:
- QString/HString conversion functions. These normally take 3-4 lines. An inline function or macro could make it a one-liner. See "qt_QStringFromHString" in qnativesocketengine_winrt.cpp for inspiration.
- Print qErrnoWarning and return when an HRESULT fails. For example:
- RETURN_VOID_IF_FAILED() // used inside constructors and functions which return void
- RETURN_FALSE_IF_FAILED() // used inside methods that return bool
- RETURN_HR_IF_FAILED() // used inside callbacks
- RETURN_OK_IF_FAILED() // used inside callbacks that have side effects
- Global getters for the Core Window/Dispatcher might also be useful. This is done in several places (to great verbosity) and could be centralized into one location.
- HRESULT getCoreWindow(ICoreWindow **);
- HRESULT getCoreDispatcher(ICoreDispatcher **);