1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-04 06:45:45 +02:00

debug: fix tag and constraints for Scaffold components

Change-Id: Ic83ec55631e9a914a53869f112032f3459b2e1c7
This commit is contained in:
Andreas Traczyk 2022-10-28 14:05:42 -04:00 committed by Sébastien Blin
parent 4245c13a42
commit 8f7891d038

View file

@ -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 {
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 {
} }
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) {