qml, build, doc: Allow import QtQuick.Layouts #45

Manually merged
hebasto merged 1 commit from 211003-layouts into main 2021-10-03 14:12:00 +00:00 AGit
hebasto commented 2021-10-03 11:33:18 +00:00 (Migrated from github.com)

See #39:

... we could at least add quick layouts.

See #39: > ... we could at least add quick layouts.
promag commented 2021-10-03 12:56:43 +00:00 (Migrated from github.com)

Tested ACK 5ce77ad32f.

Tested ACK 5ce77ad32fcf392654f441f786aeb3d34ca7c08e.
promag commented 2021-10-03 13:02:25 +00:00 (Migrated from github.com)

Applied the following locally

diff --git a/src/qml/components/BlockCounter.qml b/src/qml/components/BlockCounter.qml
index e23ba7b72d..3b4bd043fc 100644
--- a/src/qml/components/BlockCounter.qml
+++ b/src/qml/components/BlockCounter.qml
@@ -16,6 +16,5 @@ Label {
     padding: 16
     horizontalAlignment: Text.AlignHCenter
     verticalAlignment: Text.AlignVCenter
-    font.pixelSize: height / 3
     text: blockHeight
 }
diff --git a/src/qml/pages/stub.qml b/src/qml/pages/stub.qml
index 2cc87449a4..f018c4537a 100644
--- a/src/qml/pages/stub.qml
+++ b/src/qml/pages/stub.qml
@@ -10,17 +10,19 @@ import "../components" as BitcoinCoreComponents

 ApplicationWindow {
     id: appWindow
-    title: "Bitcoin Core TnG"
-    minimumWidth: 750
-    minimumHeight: 450
+    minimumWidth: layout.implicitWidth
+    minimumHeight: layout.implicitHeight
     visible: true

     Component.onCompleted: nodeModel.startNodeInitializionThread();

-    BitcoinCoreComponents.BlockCounter {
-        id: blockCounter
-        anchors.centerIn: parent
-        height: parent.height / 3
-        blockHeight: nodeModel.blockTipHeight
+    ColumnLayout {
+        id: layout
+        anchors.fill: parent
+        BitcoinCoreComponents.BlockCounter {
+            Layout.alignment: Qt.AlignCenter
+            font.pixelSize: layout.height / 3
+            blockHeight: nodeModel.blockTipHeight
+        }
     }
 }

This way window minimum size follows the implicit content size. See:

https://user-images.githubusercontent.com/3534524/135754777-f3b641ef-9611-43a8-bbad-3b21f1e63f10.mov

Applied the following locally ```diff diff --git a/src/qml/components/BlockCounter.qml b/src/qml/components/BlockCounter.qml index e23ba7b72d..3b4bd043fc 100644 --- a/src/qml/components/BlockCounter.qml +++ b/src/qml/components/BlockCounter.qml @@ -16,6 +16,5 @@ Label { padding: 16 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - font.pixelSize: height / 3 text: blockHeight } diff --git a/src/qml/pages/stub.qml b/src/qml/pages/stub.qml index 2cc87449a4..f018c4537a 100644 --- a/src/qml/pages/stub.qml +++ b/src/qml/pages/stub.qml @@ -10,17 +10,19 @@ import "../components" as BitcoinCoreComponents ApplicationWindow { id: appWindow - title: "Bitcoin Core TnG" - minimumWidth: 750 - minimumHeight: 450 + minimumWidth: layout.implicitWidth + minimumHeight: layout.implicitHeight visible: true Component.onCompleted: nodeModel.startNodeInitializionThread(); - BitcoinCoreComponents.BlockCounter { - id: blockCounter - anchors.centerIn: parent - height: parent.height / 3 - blockHeight: nodeModel.blockTipHeight + ColumnLayout { + id: layout + anchors.fill: parent + BitcoinCoreComponents.BlockCounter { + Layout.alignment: Qt.AlignCenter + font.pixelSize: layout.height / 3 + blockHeight: nodeModel.blockTipHeight + } } } ``` This way window minimum size follows the implicit content size. See: https://user-images.githubusercontent.com/3534524/135754777-f3b641ef-9611-43a8-bbad-3b21f1e63f10.mov
jarolrod (Migrated from github.com) reviewed 2021-10-03 20:24:40 +00:00
jarolrod (Migrated from github.com) left a comment

ACK 5ce77ad32f

Tested on macOS 12. Am not able to test on Ubuntu right now, will circle back to ensure that the runtime dependencies added here are the correct and only ones needed.

Thanks @promag for the convenient diff that allows for testing of the introduced feature.

ACK 5ce77ad32fcf392654f441f786aeb3d34ca7c08e Tested on macOS 12. Am not able to test on Ubuntu right now, will circle back to ensure that the runtime dependencies added here are the correct and only ones needed. Thanks @promag for the convenient diff that allows for testing of the introduced feature.
Sign in to join this conversation.
No description provided.