From ad7227ada177dec4e61e8bbc51dd70f00a6e3d15 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Wed, 25 Jan 2023 09:03:15 +0800 Subject: [PATCH] Use qt_winrtbase_p.h workaround in more places MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch addresses the following issues: (1) some places are still using the original workaround, replace them with the new qt_winrtbase_p.h workaround. (2) add more comment to let people know how to workaround other cppwinrt issues (it was a common issue for many years and may be fixed upstream recently, but let's at least document it in case the user is still using old version cppwinrt). Amends commit b2c1237b4512480a17009afe1981af02c2a9869e Pick-to: 6.5 6.4 Change-Id: Ife676f41739bbe69d9fb23bf5758be4b1fab4855 Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Oliver Wolff --- src/corelib/platform/windows/qt_winrtbase_p.h | 6 ++++-- src/plugins/platforms/windows/qwindowsapplication.cpp | 10 +--------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/corelib/platform/windows/qt_winrtbase_p.h b/src/corelib/platform/windows/qt_winrtbase_p.h index 36551b7faf..fb7366f93d 100644 --- a/src/corelib/platform/windows/qt_winrtbase_p.h +++ b/src/corelib/platform/windows/qt_winrtbase_p.h @@ -18,8 +18,8 @@ #include #if QT_CONFIG(cpp_winrt) -#include -#include +# include +# include // Workaround for Windows SDK bug. // See https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/issues/47 namespace winrt::impl @@ -27,6 +27,8 @@ namespace winrt::impl template auto wait_for(Async const& async, Windows::Foundation::TimeSpan const& timeout); } +// See https://learn.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/faq#how-do-i-resolve-ambiguities-with-getcurrenttime-and-or-try- +// for more workarounds. #endif // QT_CONFIG(cpp/winrt) #endif // QT_WINRTBASE_P_H diff --git a/src/plugins/platforms/windows/qwindowsapplication.cpp b/src/plugins/platforms/windows/qwindowsapplication.cpp index 5d1b6d348b..f823a69552 100644 --- a/src/plugins/platforms/windows/qwindowsapplication.cpp +++ b/src/plugins/platforms/windows/qwindowsapplication.cpp @@ -16,15 +16,7 @@ #include #if QT_CONFIG(cpp_winrt) -# include -# include -// Workaround for Windows SDK bug. -// See https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/issues/47 -namespace winrt::impl -{ - template - auto wait_for(Async const& async, Windows::Foundation::TimeSpan const& timeout); -} +# include # include #endif // QT_CONFIG(cpp_winrt)