Skip to content

Commit c4be0bd

Browse files
committed
Merge bitcoin-core#795: qml: Use Settings type from QtCore on Qt >= 6.5
ea12a28 ci: Add Ubuntu 26.04 job to cover Qt >= 6.5 code path (Hennadii Stepanov) a8e0403 qml: Use `Settings` type from `QtCore` on Qt >= 6.5 (Hennadii Stepanov) 3996808 test: Load QML test files from the resource system (Hennadii Stepanov) Pull request description: The `Settings` type from `Qt.labs.settings` is deprecated since Qt 6.5. Introduce a build-time-selected `AppSettings` compatibility type that uses `QtCore` on Qt >= 6.5 and `Qt.labs.settings` on older versions, keeping compatibility with the minimum required Qt 6.2. Fixes bitcoin-core#780. An alternative to bitcoin-core#781. ACKs for top commit: johnny9: ACK ea12a28 Tree-SHA512: 1b67035ae6ecbc5e3a2b5641f22c53ca402c51d89906224962301a143849611069b336aef5b244576acdf353142bddf107c4234f24df958962a3a33fe63a8ad0
2 parents fc01a57 + ea12a28 commit c4be0bd

19 files changed

Lines changed: 98 additions & 22 deletions

.github/workflows/ci.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@ on:
88

99
jobs:
1010
linux:
11-
runs-on: ubuntu-24.04
11+
name: ${{ matrix.job_name }}
12+
runs-on: ${{ matrix.image }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- job_name: 'Ubuntu 24.04, Qt 6.4'
18+
image: ubuntu-24.04
19+
- job_name: 'Ubuntu 26.04, Qt 6.10'
20+
image: ubuntu-26.04
21+
1222
env:
1323
BUILD_APP_TESTS: ON
1424
steps:

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ if(APPLE)
7878
list(APPEND QML_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/qml/models/macdockiconhandler.mm")
7979
endif()
8080

81-
set(QML_QRC "${CMAKE_CURRENT_SOURCE_DIR}/qml/bitcoin_qml.qrc")
81+
set(QML_QRC ${CMAKE_CURRENT_SOURCE_DIR}/qml/bitcoin_qml.qrc)
82+
if(Qt6_VERSION VERSION_GREATER_EQUAL 6.5)
83+
list(APPEND QML_QRC ${CMAKE_CURRENT_SOURCE_DIR}/qml/compat/qt65/bitcoin_compat.qrc)
84+
else()
85+
list(APPEND QML_QRC ${CMAKE_CURRENT_SOURCE_DIR}/qml/compat/qt62/bitcoin_compat.qrc)
86+
endif()
8287
qt6_add_resources(QML_QRC_CPP ${QML_QRC})
8388
# See: https://bugreports.qt.io/browse/QTBUG-141858.
8489
get_target_property(warn_flags warn_interface INTERFACE_COMPILE_OPTIONS)

qml/bitcoin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ int QmlGuiMain(int argc, char* argv[])
398398
#endif // WIN32
399399

400400
Q_INIT_RESOURCE(bitcoin_qml);
401+
Q_INIT_RESOURCE(bitcoin_compat);
401402
qRegisterMetaType<interfaces::BlockAndHeaderTipInfo>("interfaces::BlockAndHeaderTipInfo");
402403

403404
QGuiApplication::styleHints()->setTabFocusBehavior(Qt::TabFocusAllControls);

qml/compat/qt62/AppSettings.qml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Qt.labs.settings 1.0
2+
3+
Settings { }

qml/compat/qt62/bitcoin_compat.qrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!DOCTYPE RCC><RCC version="1.0">
2+
<qresource prefix="/qml">
3+
<file alias="controls/AppSettings.qml">AppSettings.qml</file>
4+
</qresource>
5+
</RCC>

qml/compat/qt65/AppSettings.qml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import QtCore
2+
3+
Settings { }

qml/compat/qt65/bitcoin_compat.qrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!DOCTYPE RCC><RCC version="1.0">
2+
<qresource prefix="/qml">
3+
<file alias="controls/AppSettings.qml">AppSettings.qml</file>
4+
</qresource>
5+
</RCC>

qml/components/BlockClock.qml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import QtQuick 2.15
66
import QtQuick.Controls 2.15
77
import QtQuick.Layouts 1.15
8-
import Qt.labs.settings 1.0
98

109
import org.bitcoincore.qt 1.0
1110

@@ -41,7 +40,7 @@ Item {
4140

4241
activeFocusOnTab: true
4342

44-
Settings {
43+
AppSettings {
4544
id: settings
4645
property alias blockclocksize: dial.scale
4746
}

qml/components/ThemeSettings.qml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import QtQuick 2.15
66
import QtQuick.Controls 2.15
77
import QtQuick.Layouts 1.15
8-
import Qt.labs.settings 1.0
98
import org.bitcoincore.qt 1.0
109
import "../controls"
1110

@@ -15,7 +14,7 @@ ColumnLayout {
1514

1615
signal designSystemRequested
1716

18-
Settings {
17+
AppSettings {
1918
id: settings
2019
}
2120

qml/controls/Theme.qml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
pragma Singleton
22
import QtQuick 2.15
33
import QtQuick.Controls 2.15
4-
import Qt.labs.settings 1.0
54

65
Control {
76
id: root
@@ -11,7 +10,7 @@ Control {
1110
readonly property ImageSet image: dark ? darkImageSet : lightImageSet
1211
readonly property TextSet text: TextSet {}
1312

14-
Settings {
13+
AppSettings {
1514
id: settings
1615
property alias dark: root.dark
1716
property alias blockclocksize: root.blockclocksize

0 commit comments

Comments
 (0)