summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2022-08-26 10:09:15 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-08-26 16:21:47 +0200
commit0988ad85216c117f815e8e9ef20e7b7dfe10f1a8 (patch)
tree0859c292c8383a2b16d54329625aee0d58d61526
parentd7ea07c8c1c51e3966388ab794a90e882e978d89 (diff)
Remove superfluous clang preprocessor check for cpp/winrt
The cpp/winrt configure test fails if clang is being used so there is no need to explicitly check for the compiler. Change-Id: Ifb2cb792cf3ea2d2ff09be6e47d741f09aec765f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--src/corelib/text/qlocale_win.cpp8
-rw-r--r--src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.cpp12
-rw-r--r--src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.h8
-rw-r--r--src/plugins/networkinformation/networklistmanager/qnetworklistmanagernetworkinformationbackend.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp13
5 files changed, 19 insertions, 24 deletions
diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp
index dc867be696..7ec5dcd213 100644
--- a/src/corelib/text/qlocale_win.cpp
+++ b/src/corelib/text/qlocale_win.cpp
@@ -19,7 +19,7 @@
# include <time.h>
#endif
-#if QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG)
+#if QT_CONFIG(cpp_winrt)
# include <winrt/base.h>
// Workaround for Windows SDK bug.
// See https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/issues/47
@@ -31,7 +31,7 @@ namespace winrt::impl
# include <winrt/Windows.Foundation.h>
# include <winrt/Windows.Foundation.Collections.h>
# include <winrt/Windows.System.UserProfile.h>
-#endif // QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG)
+#endif // QT_CONFIG(cpp_winrt)
QT_BEGIN_NAMESPACE
@@ -661,7 +661,7 @@ QVariant QSystemLocalePrivate::toCurrencyString(const QSystemLocale::CurrencyToS
QVariant QSystemLocalePrivate::uiLanguages()
{
QStringList result;
-#if QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG)
+#if QT_CONFIG(cpp_winrt)
using namespace winrt;
using namespace Windows::System::UserProfile;
auto languages = GlobalizationPreferences::Languages();
@@ -669,7 +669,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 // QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG)
+#endif // QT_CONFIG(cpp_winrt)
// mingw and clang still have to use Win32 API
unsigned long cnt = 0;
QVarLengthArray<wchar_t, 64> buf(64);
diff --git a/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.cpp b/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.cpp
index 72023c6628..8d4411c10b 100644
--- a/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.cpp
+++ b/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.cpp
@@ -3,7 +3,7 @@
#include "qnetworklistmanagerevents.h"
-#ifdef SUPPORTS_WINRT
+#if QT_CONFIG(cpp_winrt)
#include <winrt/base.h>
// Workaround for Windows SDK bug.
// See https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/issues/47
@@ -14,7 +14,7 @@ namespace winrt::impl
}
#include <winrt/Windows.Networking.Connectivity.h>
-#endif
+#endif // QT_CONFIG(cpp_winrt)
QT_BEGIN_NAMESPACE
@@ -99,7 +99,7 @@ bool QNetworkListManagerEvents::start()
else
emit connectivityChanged(connectivity);
-#ifdef SUPPORTS_WINRT
+#if QT_CONFIG(cpp_winrt)
using namespace winrt::Windows::Networking::Connectivity;
// Register for changes in the network and store a token to unregister later:
token = NetworkInformation::NetworkStatusChanged(
@@ -125,7 +125,7 @@ bool QNetworkListManagerEvents::stop()
}
cookie = 0;
-#ifdef SUPPORTS_WINRT
+#if QT_CONFIG(cpp_winrt)
using namespace winrt::Windows::Networking::Connectivity;
// Pass the token we stored earlier to unregister:
NetworkInformation::NetworkStatusChanged(token);
@@ -172,7 +172,7 @@ bool QNetworkListManagerEvents::checkBehindCaptivePortal()
return false;
}
-#ifdef SUPPORTS_WINRT
+#if QT_CONFIG(cpp_winrt)
namespace {
using namespace winrt::Windows::Networking::Connectivity;
// NB: this isn't part of "network list manager", but sadly NLM doesn't have an
@@ -223,6 +223,6 @@ void QNetworkListManagerEvents::emitWinRTUpdates()
emit transportMediumChanged(getTransportMedium(profile));
emit isMeteredChanged(getMetered(profile));
}
-#endif
+#endif // QT_CONFIG(cpp_winrt)
QT_END_NAMESPACE
diff --git a/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.h b/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.h
index cf9a08ca84..d5a23a1815 100644
--- a/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.h
+++ b/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.h
@@ -15,11 +15,7 @@
#include <wrl/wrappers/corewrappers.h>
#include <comdef.h>
-#if QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG)
-#define SUPPORTS_WINRT 1
-#endif
-
-#ifdef SUPPORTS_WINRT
+#if QT_CONFIG(cpp_winrt)
#include <winrt/base.h>
#endif
@@ -69,7 +65,7 @@ private:
ComPtr<INetworkListManager> networkListManager = nullptr;
ComPtr<IConnectionPoint> connectionPoint = nullptr;
-#ifdef SUPPORTS_WINRT
+#if QT_CONFIG(cpp_winrt)
void emitWinRTUpdates();
winrt::event_token token;
diff --git a/src/plugins/networkinformation/networklistmanager/qnetworklistmanagernetworkinformationbackend.cpp b/src/plugins/networkinformation/networklistmanager/qnetworklistmanagernetworkinformationbackend.cpp
index 9673d2cf69..d5582ebb30 100644
--- a/src/plugins/networkinformation/networklistmanager/qnetworklistmanagernetworkinformationbackend.cpp
+++ b/src/plugins/networkinformation/networklistmanager/qnetworklistmanagernetworkinformationbackend.cpp
@@ -68,7 +68,7 @@ public:
{
return QNetworkInformation::Features(QNetworkInformation::Feature::Reachability
| QNetworkInformation::Feature::CaptivePortal
-#ifdef SUPPORTS_WINRT
+#if QT_CONFIG(cpp_winrt)
| QNetworkInformation::Feature::TransportMedium
#endif
);
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index adc4befaec..38311363c5 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -46,7 +46,7 @@
#include <algorithm>
-#if QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG)
+#if QT_CONFIG(cpp_winrt)
# include <winrt/base.h>
// Workaround for Windows SDK bug.
// See https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/issues/47
@@ -56,8 +56,7 @@ namespace winrt::impl
auto wait_for(Async const& async, Windows::Foundation::TimeSpan const& timeout);
}
# include <winrt/Windows.UI.ViewManagement.h>
-# define HAS_UISETTINGS 1
-#endif
+#endif // QT_CONFIG(cpp_winrt)
#if defined(__IImageList_INTERFACE_DEFINED__) && defined(__IID_DEFINED__)
# define USE_IIMAGELIST
@@ -111,7 +110,7 @@ static inline QColor getSysColor(int index)
return COLORREFToQColor(GetSysColor(index));
}
-#if defined(HAS_UISETTINGS)
+#if QT_CONFIG(cpp_winrt)
static constexpr QColor getSysColor(winrt::Windows::UI::Color &&color)
{
return QColor(color.R, color.G, color.B, color.A);
@@ -261,7 +260,7 @@ static void populateLightSystemBasePalette(QPalette &result)
QColor textColor = getSysColor(COLOR_WINDOWTEXT);
QColor accent = getSysColor(COLOR_HIGHLIGHT);
-#if defined(HAS_UISETTINGS)
+#if QT_CONFIG(cpp_winrt)
if (QWindowsIntegration::instance()->darkModeHandling().testFlag(QWindowsApplication::DarkModeStyle)) {
using namespace winrt::Windows::UI::ViewManagement;
const auto settings = UISettings();
@@ -304,7 +303,7 @@ static void populateLightSystemBasePalette(QPalette &result)
static void populateDarkSystemBasePalette(QPalette &result)
{
-#if defined(HAS_UISETTINGS)
+#if QT_CONFIG(cpp_winrt)
using namespace winrt::Windows::UI::ViewManagement;
const auto settings = UISettings();
@@ -593,7 +592,7 @@ void QWindowsTheme::refreshPalettes()
m_palettes[MenuPalette] = new QPalette(menuPalette(*m_palettes[SystemPalette], light));
m_palettes[MenuBarPalette] = menuBarPalette(*m_palettes[MenuPalette], light);
if (!light) {
-#if defined(HAS_UISETTINGS)
+#if QT_CONFIG(cpp_winrt)
using namespace winrt::Windows::UI::ViewManagement;
const auto settings = UISettings();
const QColor accent = getSysColor(settings.GetColorValue(UIColorType::Accent));