diff --git a/qml/controls/InformationPage.qml b/qml/controls/InformationPage.qml index 12d5af4c32..76b6bb45f9 100644 --- a/qml/controls/InformationPage.qml +++ b/qml/controls/InformationPage.qml @@ -45,6 +45,7 @@ Page { background: null clip: true + contentWidth: root.maximumWidth header: NavigationBar { id: navbar @@ -60,7 +61,7 @@ Page { ColumnLayout { id: information - width: Math.min(parent.width, 600) + width: Math.min(parent.width, root.maximumWidth) anchors.horizontalCenter: parent.horizontalCenter spacing: 0 Loader { diff --git a/qml/pages/settings/SettingsStorage.qml b/qml/pages/settings/SettingsStorage.qml index 06820f5605..fa8e78712c 100644 --- a/qml/pages/settings/SettingsStorage.qml +++ b/qml/pages/settings/SettingsStorage.qml @@ -10,6 +10,7 @@ import "../../components" InformationPage { id: root + objectName: "settingsStoragePage" property var settingsModel: optionsModel property bool customStorage: false property int customStorageAmount diff --git a/qml/pages/settings/SettingsWallet.qml b/qml/pages/settings/SettingsWallet.qml index 12a38e4dee..ba55892808 100644 --- a/qml/pages/settings/SettingsWallet.qml +++ b/qml/pages/settings/SettingsWallet.qml @@ -15,8 +15,10 @@ Page { signal back property bool showBackButton: true + readonly property int maximumContentWidth: 450 background: null + contentWidth: root.maximumContentWidth header: SettingsHeader { title: qsTr("External signer") @@ -31,7 +33,7 @@ Page { clip: true ColumnLayout { - width: Math.min(parent.width, 450) + width: Math.min(parent.width, root.maximumContentWidth) anchors.horizontalCenter: parent.horizontalCenter spacing: 0 diff --git a/test/qml/tst_nodesettings.qml b/test/qml/tst_nodesettings.qml index d89f849915..cd3e649665 100644 --- a/test/qml/tst_nodesettings.qml +++ b/test/qml/tst_nodesettings.qml @@ -250,4 +250,30 @@ TestCase { verify(walletStack.depth > 1) compare(walletSettingsPage.showBackButton, false) } + + function test_section_pages_keep_implicit_width_independent_of_layout() { + const page = createNodeSettingsPage() + + const sections = [ + { index: 1, name: "settingsWallet" }, + { index: 4, name: "settingsStoragePage" }, + { index: 7, name: "mempoolInformationSettingsPage" } + ] + + for (let i = 0; i < sections.length; ++i) { + page.currentSection = sections[i].index + wait(0) + + const sectionPage = findChild(page, sections[i].name) + verify(sectionPage !== null, sections[i].name + " was not created") + + const implicitWidthBefore = sectionPage.implicitWidth + const widthBefore = sectionPage.width + sectionPage.width = widthBefore / 2 + verify(sectionPage.width !== widthBefore, + sections[i].name + " ignored the width it was given") + compare(sectionPage.implicitWidth, implicitWidthBefore, + sections[i].name + " implicit width followed the width it was given") + } + } }