QGCControlDebug.qml 1.81 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/****************************************************************************
 *
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

import QtQuick 2.12

12 13 14 15 16
Rectangle {
    id:             _root
    border.width:   borderColor === undefined ? 0 : 1
    border.color:   borderColor
    color:          "transparent"
17

18 19 20 21 22 23 24 25
    property string name
    property color  borderColor

    function logEverything() {
        console.log(qsTr("%1 x:%2 y:%3 width:%4 height:%5 visible: %6 enabled: %7 z:%8 parent:%9 implicitWidth/Height:%10:%11", "Do not translate").arg(name).arg(parent.x).arg(parent.y).arg(parent.width).arg(parent.height).arg(parent.visible).arg(parent.enabled).arg(parent.z).arg(parent.parent))
    }

    Component.onCompleted: logEverything()
26

27 28
    Connections {
        target:             parent
29 30 31 32 33 34 35 36
        onXChanged:         { console.log(name, "xChanged",       parent.x);        logEverything() }
        onYChanged:         { console.log(name, "yChanged",       parent.y);        logEverything() }
        onWidthChanged:     { console.log(name, "widthChanged",   parent.width);    logEverything() }
        onHeightChanged:    { console.log(name, "heightChanged",  parent.height);   logEverything() }
        onVisibleChanged:   { console.log(name, "visibleChanged", parent.visible);  logEverything() }
        onZChanged:         { console.log(name, "zChanged",       parent.z);        logEverything() }
        onParentChanged:    { console.log(name, "parentChanged",  parent.parent);   logEverything() }
        onEnabledChanged:   { console.log(name, "enabledChanged", parent.enabled);  logEverything() }
37 38
    }
}