From 13167e67e823184b5ad8b290af20ade0e8a13bef Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 2 Aug 2024 11:44:20 +0100 Subject: [PATCH 1/2] Revert "qt: Drop `Q_IMPORT_PLUGIN` macros" This reverts commit 9c4eaec825ea89d348db13887ea7c1399f3c3bca. --- src/qt/bitcoin.cpp | 15 +++++++++++++++ src/qt/test/test_main.cpp | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index c3a031319a806..690c2b6f5a10c 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -60,6 +60,21 @@ #include #include +#if defined(QT_STATIC) +#include +#if defined(QT_QPA_PLATFORM_XCB) +Q_IMPORT_PLUGIN(QXcbIntegrationPlugin); +#elif defined(QT_QPA_PLATFORM_WINDOWS) +Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); +Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin); +#elif defined(QT_QPA_PLATFORM_COCOA) +Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin); +Q_IMPORT_PLUGIN(QMacStylePlugin); +#elif defined(QT_QPA_PLATFORM_ANDROID) +Q_IMPORT_PLUGIN(QAndroidPlatformIntegrationPlugin) +#endif +#endif + // Declare meta types used for QMetaObject::invokeMethod Q_DECLARE_METATYPE(bool*) Q_DECLARE_METATYPE(CAmount) diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index 958cc7ae88c2d..c150606cfb90b 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -28,6 +28,22 @@ #include +#if defined(QT_STATIC) +#include +#if defined(QT_QPA_PLATFORM_MINIMAL) +Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin); +#endif +#if defined(QT_QPA_PLATFORM_XCB) +Q_IMPORT_PLUGIN(QXcbIntegrationPlugin); +#elif defined(QT_QPA_PLATFORM_WINDOWS) +Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); +#elif defined(QT_QPA_PLATFORM_COCOA) +Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin); +#elif defined(QT_QPA_PLATFORM_ANDROID) +Q_IMPORT_PLUGIN(QAndroidPlatformIntegrationPlugin) +#endif +#endif + const std::function G_TEST_LOG_FUN{}; const std::function()> G_TEST_COMMAND_LINE_ARGUMENTS{}; From 078294d1b96d87a104b38b8ccc341f20b112eeab Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 2 Aug 2024 11:51:29 +0100 Subject: [PATCH 2/2] fixup! cmake: Build `bitcoin-qt` executable Add a TODO comment. --- src/qt/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index 90bab3675c1b2..dc62d0f57e22d 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -13,6 +13,9 @@ endif() get_target_property(qt_lib_type Qt5::Core TYPE) +# TODO: After the transition from Autotools to CMake, +# all `Q_IMPORT_PLUGIN` macros can be deleted from the +# qt/bitcoin.cpp and qt/test/test_main.cpp source files. function(import_plugins target) if(qt_lib_type STREQUAL "STATIC_LIBRARY") set(plugins Qt5::QMinimalIntegrationPlugin) @@ -24,8 +27,8 @@ function(import_plugins target) list(APPEND plugins Qt5::QCocoaIntegrationPlugin Qt5::QMacStylePlugin) endif() qt5_import_plugins(${target} - INCLUDE ${plugins} - EXCLUDE_BY_TYPE imageformats iconengines + INCLUDE ${plugins} + EXCLUDE_BY_TYPE imageformats iconengines ) endif() endfunction()