qml Property binding Basics about property bindings


Example

Consider this simple example:

import QtQuick 2.7
import QtQuick.Controls 2.0

ApplicationWindow {
    visible: true
    width: 400
    height: 640

    Rectangle{
        id: rect
        anchors.centerIn: parent
        height: 100
        width: parent.width
        color: "blue"
    }
}

In the above example, the width of Rectangle is bound to that of it's parent. If you change the width of the running application window, the width of rectangle also changes.