diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp index dc867be6966..7ec5dcd2135 100644 --- a/src/corelib/text/qlocale_win.cpp +++ b/src/corelib/text/qlocale_win.cpp @@ -19,7 +19,7 @@ # include #endif -#if QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG) +#if QT_CONFIG(cpp_winrt) # include // 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 # include # include -#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 buf(64); diff --git a/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.cpp b/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.cpp index 72023c6628d..8d4411c10b3 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 // 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 -#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 cf9a08ca844..d5a23a18158 100644 --- a/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.h +++ b/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.h @@ -15,11 +15,7 @@ #include #include -#if QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG) -#define SUPPORTS_WINRT 1 -#endif - -#ifdef SUPPORTS_WINRT +#if QT_CONFIG(cpp_winrt) #include #endif @@ -69,7 +65,7 @@ private: ComPtr networkListManager = nullptr; ComPtr 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 9673d2cf696..d5582ebb30c 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 adc4befaec9..38311363c5a 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -46,7 +46,7 @@ #include -#if QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG) +#if QT_CONFIG(cpp_winrt) # include // 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 -# 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));