mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-08 13:49:35 +02:00
Merge bitcoin/bitcoin#30997: build: Switch to Qt 6
f00345727bdoc: Update `dependencies.md` for Qt 6 (Hennadii Stepanov)80b917991ebuild, msvc: Update `vcpkg.json` for Qt 6 (Hennadii Stepanov)30dd1f1644ci: Update for Qt 6 (Hennadii Stepanov)629d292f4dtest: Update sanitizer suppressions for Qt 6 (Hennadii Stepanov)551e13abf8guix: Adjust for Qt 6 (Hennadii Stepanov)c3e9bd086cqt: Fix compiling for Windows (Hennadii Stepanov)ab399c4db2depends: Add `native_qt` package (Hennadii Stepanov)248613eb3edepends: Factor out Qt modules' details (Hennadii Stepanov)0268f52a4cdepends: Introduce customizable `$(package)_patches_path` variables (Hennadii Stepanov)5e794e6202depends: Bump `qt` package up to 6.7.3 (Hennadii Stepanov)6d4214925fcmake: Require Qt 6 to build GUI (Hennadii Stepanov) Pull request description: The currently used Qt 5.15 is approaching [EOL](https://www.qt.io/blog/qt-5.15-extended-support-for-subscription-license-holders) and will reach it before the Bitcoin Core v30 release. The recent migration of the build system to CMake makes it possible to switch to Qt 6. This PR updates the OS runtime compatibility requirements for the Bitcoin Core GUI as follows: ### 1. Linux Starting with Qt 6.5.0, the `libxcb-cursor0` package is required to be installed at runtime. ### 2. Windows Cross-compiling does not support LTO. We have to re-add it in a follow-up. A new style plugin causes minor visual glitches, such as  which will be fixed in follow-ups. ### 3. macOS `bitcoin-qt` now uses the [Metal](https://developer.apple.com/metal/) backend. --- **IMPORTANT.** Don't forget to install [Ninja](https://ninja-build.org/). --- For historical context, please refer to: - https://github.com/bitcoin/bitcoin/issues/20627 - https://github.com/bitcoin/bitcoin/pull/24798 --- UPD 2024-10-09. Qt 6.8 has been [released](https://www.qt.io/blog/qt-6.8-released), but it has some [drawbacks](https://github.com/bitcoin/bitcoin/pull/30997#issuecomment-2402990346) for us. As a result, this PR will stick to Qt 6.7. UPD 2025-03-18: [Standard support for Qt 5.15 will end after 26th of May 2025](https://www.qt.io/blog/extended-security-maintenance-for-qt-5.15-begins-may-2025) ACKs for top commit: laanwj: re-ACKf00345727bhodlinator: re-ACKf00345727bTree-SHA512: 367f722e6c3ea4700b5395871c40b6df8c8062fdc822107090449ea4ae4ad2db75cc53a982a678f4c48ce8f9b2d43ed10e6d23b06165ab78713f161db712d895
This commit is contained in:
@@ -11,21 +11,35 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
string(APPEND CMAKE_OBJCXX_COMPILE_OBJECT " ${APPEND_CPPFLAGS} ${APPEND_CXXFLAGS}")
|
||||
endif()
|
||||
|
||||
get_target_property(qt_lib_type Qt5::Core TYPE)
|
||||
get_target_property(qt_lib_type Qt6::Core TYPE)
|
||||
|
||||
function(import_plugins target)
|
||||
if(qt_lib_type STREQUAL "STATIC_LIBRARY")
|
||||
set(plugins Qt5::QMinimalIntegrationPlugin)
|
||||
set(plugins Qt6::QMinimalIntegrationPlugin)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
list(APPEND plugins Qt5::QXcbIntegrationPlugin)
|
||||
list(APPEND plugins Qt6::QXcbIntegrationPlugin)
|
||||
elseif(WIN32)
|
||||
list(APPEND plugins Qt5::QWindowsIntegrationPlugin Qt5::QWindowsVistaStylePlugin)
|
||||
list(APPEND plugins Qt6::QWindowsIntegrationPlugin Qt6::QModernWindowsStylePlugin)
|
||||
elseif(APPLE)
|
||||
list(APPEND plugins Qt5::QCocoaIntegrationPlugin Qt5::QMacStylePlugin)
|
||||
list(APPEND plugins Qt6::QCocoaIntegrationPlugin Qt6::QMacStylePlugin)
|
||||
endif()
|
||||
qt5_import_plugins(${target}
|
||||
qt6_import_plugins(${target}
|
||||
INCLUDE ${plugins}
|
||||
EXCLUDE_BY_TYPE imageformats iconengines
|
||||
EXCLUDE_BY_TYPE
|
||||
accessiblebridge
|
||||
platforms
|
||||
platforms_darwin
|
||||
xcbglintegrations
|
||||
platformthemes
|
||||
platforminputcontexts
|
||||
generic
|
||||
iconengines
|
||||
imageformats
|
||||
egldeviceintegrations
|
||||
styles
|
||||
networkaccess
|
||||
networkinformation
|
||||
tls
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -45,7 +59,7 @@ set(CMAKE_AUTOUIC_SEARCH_PATHS forms)
|
||||
# to https://github.com/bitcoin-core/bitcoin-maintainer-tools/blob/main/update-translations.py
|
||||
file(GLOB ts_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} locale/*.ts)
|
||||
set_source_files_properties(${ts_files} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/locale)
|
||||
qt5_add_translation(qm_files ${ts_files})
|
||||
qt6_add_translation(qm_files ${ts_files})
|
||||
|
||||
configure_file(bitcoin_locale.qrc bitcoin_locale.qrc USE_SOURCE_PERMISSIONS COPYONLY)
|
||||
|
||||
@@ -128,7 +142,7 @@ set_property(SOURCE macnotificationhandler.mm
|
||||
)
|
||||
target_link_libraries(bitcoinqt
|
||||
PUBLIC
|
||||
Qt5::Widgets
|
||||
Qt6::Widgets
|
||||
PRIVATE
|
||||
core_interface
|
||||
bitcoin_cli
|
||||
@@ -206,19 +220,33 @@ if(ENABLE_WALLET)
|
||||
target_link_libraries(bitcoinqt
|
||||
PRIVATE
|
||||
bitcoin_wallet
|
||||
Qt5::Network
|
||||
Qt6::Network
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_DBUS)
|
||||
target_link_libraries(bitcoinqt PRIVATE Qt5::DBus)
|
||||
target_link_libraries(bitcoinqt PRIVATE Qt6::DBus)
|
||||
endif()
|
||||
|
||||
if(qt_lib_type STREQUAL "STATIC_LIBRARY")
|
||||
# We want to define static plugins to link ourselves, thus preventing
|
||||
# automatic linking against a "sane" set of default static plugins.
|
||||
qt5_import_plugins(bitcoinqt
|
||||
EXCLUDE_BY_TYPE bearer iconengines imageformats platforms styles
|
||||
qt6_import_plugins(bitcoinqt
|
||||
EXCLUDE_BY_TYPE
|
||||
accessiblebridge
|
||||
platforms
|
||||
platforms_darwin
|
||||
xcbglintegrations
|
||||
platformthemes
|
||||
platforminputcontexts
|
||||
generic
|
||||
iconengines
|
||||
imageformats
|
||||
egldeviceintegrations
|
||||
styles
|
||||
networkaccess
|
||||
networkinformation
|
||||
tls
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -321,8 +349,8 @@ else()
|
||||
file(GLOB ui_files ${CMAKE_CURRENT_SOURCE_DIR}/forms/*.ui)
|
||||
add_custom_target(translate
|
||||
COMMAND ${CMAKE_COMMAND} -E env XGETTEXT=${XGETTEXT_EXECUTABLE} COPYRIGHT_HOLDERS=${COPYRIGHT_HOLDERS} ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/share/qt/extract_strings_qt.py ${translatable_sources}
|
||||
COMMAND Qt5::lupdate -no-obsolete -I ${PROJECT_SOURCE_DIR}/src -locations relative ${CMAKE_CURRENT_SOURCE_DIR}/bitcoinstrings.cpp ${ui_files} ${qt_translatable_sources} -ts ${CMAKE_CURRENT_SOURCE_DIR}/locale/bitcoin_en.ts
|
||||
COMMAND Qt5::lconvert -drop-translations -o ${CMAKE_CURRENT_SOURCE_DIR}/locale/bitcoin_en.xlf -i ${CMAKE_CURRENT_SOURCE_DIR}/locale/bitcoin_en.ts
|
||||
COMMAND Qt6::lupdate -no-obsolete -I ${PROJECT_SOURCE_DIR}/src -locations relative ${CMAKE_CURRENT_SOURCE_DIR}/bitcoinstrings.cpp ${ui_files} ${qt_translatable_sources} -ts ${CMAKE_CURRENT_SOURCE_DIR}/locale/bitcoin_en.ts
|
||||
COMMAND Qt6::lconvert -drop-translations -o ${CMAKE_CURRENT_SOURCE_DIR}/locale/bitcoin_en.xlf -i ${CMAKE_CURRENT_SOURCE_DIR}/locale/bitcoin_en.ts
|
||||
COMMAND ${SED_EXECUTABLE} -i.old -e "s|source-language=\"en\" target-language=\"en\"|source-language=\"en\"|" -e "/<target xml:space=\"preserve\"><\\/target>/d" ${CMAKE_CURRENT_SOURCE_DIR}/locale/bitcoin_en.xlf
|
||||
COMMAND ${CMAKE_COMMAND} -E rm ${CMAKE_CURRENT_SOURCE_DIR}/locale/bitcoin_en.xlf.old
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
This directory contains the source code for the Bitcoin Core graphical user interface (GUI). It uses the [Qt](https://www1.qt.io/developers/) cross-platform framework.
|
||||
|
||||
The current precise version for Qt 5 is specified in [qt.mk](/depends/packages/qt.mk).
|
||||
The current precise version for Qt is specified in [qt_details.mk](/depends/packages/qt_details.mk).
|
||||
|
||||
## Compile and run
|
||||
|
||||
|
||||
@@ -88,7 +88,11 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p
|
||||
|
||||
// Coin Control
|
||||
connect(ui->pushButtonCoinControl, &QPushButton::clicked, this, &SendCoinsDialog::coinControlButtonClicked);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
connect(ui->checkBoxCoinControlChange, &QCheckBox::checkStateChanged, this, &SendCoinsDialog::coinControlChangeChecked);
|
||||
#else
|
||||
connect(ui->checkBoxCoinControlChange, &QCheckBox::stateChanged, this, &SendCoinsDialog::coinControlChangeChecked);
|
||||
#endif
|
||||
connect(ui->lineEditCoinControlChange, &QValidatedLineEdit::textEdited, this, &SendCoinsDialog::coinControlChangeEdited);
|
||||
|
||||
// Coin Control: clipboard actions
|
||||
@@ -183,8 +187,13 @@ void SendCoinsDialog::setModel(WalletModel *_model)
|
||||
#endif
|
||||
|
||||
connect(ui->customFee, &BitcoinAmountField::valueChanged, this, &SendCoinsDialog::coinControlUpdateLabels);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
connect(ui->optInRBF, &QCheckBox::checkStateChanged, this, &SendCoinsDialog::updateSmartFeeLabel);
|
||||
connect(ui->optInRBF, &QCheckBox::checkStateChanged, this, &SendCoinsDialog::coinControlUpdateLabels);
|
||||
#else
|
||||
connect(ui->optInRBF, &QCheckBox::stateChanged, this, &SendCoinsDialog::updateSmartFeeLabel);
|
||||
connect(ui->optInRBF, &QCheckBox::stateChanged, this, &SendCoinsDialog::coinControlUpdateLabels);
|
||||
#endif
|
||||
CAmount requiredFee = model->wallet().getRequiredFee(1000);
|
||||
ui->customFee->SetMinValue(requiredFee);
|
||||
if (ui->customFee->value() < requiredFee) {
|
||||
@@ -944,7 +953,11 @@ void SendCoinsDialog::coinControlButtonClicked()
|
||||
}
|
||||
|
||||
// Coin Control: checkbox custom change address
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
void SendCoinsDialog::coinControlChangeChecked(Qt::CheckState state)
|
||||
#else
|
||||
void SendCoinsDialog::coinControlChangeChecked(int state)
|
||||
#endif
|
||||
{
|
||||
if (state == Qt::Unchecked)
|
||||
{
|
||||
|
||||
@@ -103,7 +103,11 @@ private Q_SLOTS:
|
||||
void refreshBalance();
|
||||
void coinControlFeatureChanged(bool);
|
||||
void coinControlButtonClicked();
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
void coinControlChangeChecked(Qt::CheckState);
|
||||
#else
|
||||
void coinControlChangeChecked(int);
|
||||
#endif
|
||||
void coinControlChangeEdited(const QString &);
|
||||
void coinControlUpdateLabels();
|
||||
void coinControlClipboardQuantity();
|
||||
|
||||
@@ -20,7 +20,7 @@ target_link_libraries(test_bitcoin-qt
|
||||
test_util
|
||||
bitcoin_node
|
||||
Boost::headers
|
||||
Qt5::Test
|
||||
Qt6::Test
|
||||
)
|
||||
|
||||
import_plugins(test_bitcoin-qt)
|
||||
|
||||
Reference in New Issue
Block a user