summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qlocale_win.cpp
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2021-10-12 09:21:03 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2021-10-12 21:34:02 +0000
commitd24651d548d6f86f988dd28ccfe2370f4af75765 (patch)
tree9eb26287ddfd5c966a39552f10e9124f52c9d8db /src/corelib/text/qlocale_win.cpp
parentced47a05aa3a59710ef1abe1474b76ddb5460049 (diff)
Guard WinRT API code for clang-cl
It is unsupported with clang-cl and breaks the build. This is a fixup for: 51e8d3592a Let QLocale::uiLanguages() use WinRT API when possible Task-number: QTBUG-94341 Pick-to: 6.2 Change-Id: Icf32339e81d67d4c119b7fb8d8d834c744b9ead0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qlocale_win.cpp')
-rw-r--r--src/corelib/text/qlocale_win.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp
index d2dd07e549..191533c886 100644
--- a/src/corelib/text/qlocale_win.cpp
+++ b/src/corelib/text/qlocale_win.cpp
@@ -51,7 +51,7 @@
# include <time.h>
#endif
-#if defined(Q_CC_MSVC)
+#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
# include <winrt/base.h>
// Workaround for Windows SDK bug.
// See https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/issues/47
@@ -63,7 +63,7 @@ namespace winrt::impl
# include <winrt/Windows.Foundation.h>
# include <winrt/Windows.Foundation.Collections.h>
# include <winrt/Windows.System.UserProfile.h>
-#endif // defined(Q_CC_MSVC)
+#endif // defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
QT_BEGIN_NAMESPACE
@@ -630,7 +630,7 @@ QVariant QSystemLocalePrivate::toCurrencyString(const QSystemLocale::CurrencyToS
QVariant QSystemLocalePrivate::uiLanguages()
{
QStringList result;
-#if defined(Q_CC_MSVC) // msvc supports WinRT calls
+#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) // msvc supports WinRT calls
using namespace winrt;
using namespace Windows::Foundation;
using namespace Windows::System::UserProfile;
@@ -639,7 +639,7 @@ QVariant QSystemLocalePrivate::uiLanguages()
result << QString::fromStdString(winrt::to_string(lang));
if (!result.isEmpty())
return result; // else just fall back to WIN32 API implementation
-#endif // defined(Q_CC_MSVC)
+#endif // defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
// mingw and clang still have to use Win32 API
unsigned long cnt = 0;
QVarLengthArray<wchar_t, 64> buf(64);