Skip to content
Snippets Groups Projects
Commit 8f7891d0 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Sébastien Blin
Browse files

debug: fix tag and constraints for Scaffold components

Change-Id: Ic83ec55631e9a914a53869f112032f3459b2e1c7
parent 4245c13a
No related branches found
No related tags found
No related merge requests found
...@@ -18,12 +18,13 @@ ...@@ -18,12 +18,13 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts
// UI dev tool to visualize components/layouts // UI dev tool to visualize components/layouts
Rectangle { Rectangle {
property alias name: label.text property alias name: label.text
property bool stretchParent: false property bool stretchParent: false
property string tag: this.toString() property string tag: parent.toString()
signal moveX(real dx) signal moveX(real dx)
signal moveY(real dy) signal moveY(real dy)
property real ox: 0 property real ox: 0
...@@ -37,7 +38,9 @@ Rectangle { ...@@ -37,7 +38,9 @@ Rectangle {
var b = Math.random() * 0.5 + 0.5; var b = Math.random() * 0.5 + 0.5;
Qt.rgba(r, g, b, 0.5); Qt.rgba(r, g, b, 0.5);
} }
anchors.fill: parent
anchors.fill: parent instanceof Layout ? undefined : parent
focus: false focus: false
Keys.onPressed: { Keys.onPressed: {
if (event.key === Qt.Key_Left) if (event.key === Qt.Key_Left)
...@@ -53,9 +56,14 @@ Rectangle { ...@@ -53,9 +56,14 @@ Rectangle {
} }
Component.onCompleted: { 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 // fallback to some description of the object
if (label.text === "") if (label.text === "")
label.text = this.toString(); label.text = tag;
// force the parent to be at least the dimensions of children // force the parent to be at least the dimensions of children
if (stretchParent) { if (stretchParent) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment