Hi,

I was wondering if there are general patterns or best practices on how
to omit/resolve QML binding loops.

For example, the following code does what it should do, but while
resizing the window I get a lot of warnings about the binding loop.

Rectangle {
    property double ratio: width / height
    width: 600
    height: 300
    color: "gray"

    // Rectangle with a fixed aspect ratio centered in parent
    Rectangle {
        property double ratio: 1.6
        color: "red"
        height: parent.ratio < ratio ? width / ratio : parent.height
        width: parent.ratio > ratio ? height * ratio : parent.width
        anchors.centerIn: parent
    }
}

How do others solve issues like this?

Cheers,
Conny


_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to