From 8f7891d0380d051a9b01209398ee43ee29f79d64 Mon Sep 17 00:00:00 2001 From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Date: Fri, 28 Oct 2022 14:05:42 -0400 Subject: [PATCH] debug: fix tag and constraints for Scaffold components Change-Id: Ic83ec55631e9a914a53869f112032f3459b2e1c7 --- src/app/commoncomponents/Scaffold.qml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/app/commoncomponents/Scaffold.qml b/src/app/commoncomponents/Scaffold.qml index 77f43835b..f6fa1c60f 100644 --- a/src/app/commoncomponents/Scaffold.qml +++ b/src/app/commoncomponents/Scaffold.qml @@ -18,12 +18,13 @@ import QtQuick import QtQuick.Controls +import QtQuick.Layouts // UI dev tool to visualize components/layouts Rectangle { property alias name: label.text property bool stretchParent: false - property string tag: this.toString() + property string tag: parent.toString() signal moveX(real dx) signal moveY(real dy) property real ox: 0 @@ -37,7 +38,9 @@ Rectangle { var b = Math.random() * 0.5 + 0.5; Qt.rgba(r, g, b, 0.5); } - anchors.fill: parent + + anchors.fill: parent instanceof Layout ? undefined : parent + focus: false Keys.onPressed: { if (event.key === Qt.Key_Left) @@ -53,9 +56,14 @@ Rectangle { } Component.onCompleted: { + if (parent instanceof Layout) { + width = Qt.binding(() => { return parent.width }) + height = Qt.binding(() => { return parent.height }) + } + // fallback to some description of the object if (label.text === "") - label.text = this.toString(); + label.text = tag; // force the parent to be at least the dimensions of children if (stretchParent) { -- GitLab