Better_Software_Header_MobileBetter_Software_Header_Web

Find what you need - explore our website and developer resources

New in Qt 5.10: Diagnostics when breaking QML bindings


import QtQuick 2.0

Rectangle {
    width: 100; height: 100

    // this is a binding:
    color: mouseArea.containsMouse ? "red" : "blue"

    MouseArea { id: mouseArea; anchors.fill: parent; hoverEnabled: true }
}

import QtQuick 2.0

Rectangle {
    width: 100; height: 100

    // this is still a binding
    color: mouseArea.containsMouse ? "red" : "blue"

    MouseArea {
        id: mouseArea
        anchors.fill: parent
        hoverEnabled: true
        onClicked: {
            parent.color = "green" // oops! breaks binding
        }
    }
}

export QT_LOGGING_RULES="qt.qml.binding.removal.info=true"

import QtQuick 2.0

Rectangle {
    width: 100; height: 100

    color: mouseArea.containsMouse ? "red" : "blue"

    MouseArea {
        id: mouseArea
        anchors.fill: parent
        hoverEnabled: true
        onClicked: {
            parent.color = "green"
        }
    }
}

qt.qml.binding.removal: Overwriting binding on QQuickRectangle::color
    at file:///example.qml:13
    that was initially bound at file:///example.qml:6:12

About KDAB


13 Comments

30 - Aug - 2017

Sandro F

31 - Oct - 2017

derM

19 - Jun - 2019

Faisal

19 - Jun - 2019

Giuseppe D'Angelo

15 - Jun - 2020

Arun

6 - Jul - 2020

Giuseppe D'Angelo

30 - Aug - 2020

Arun

1 - Dec - 2020

Kmarconi

15 - Feb - 2021

Giuseppe D'Angelo

15 - Feb - 2021

Pavel

15 - Feb - 2021

Giuseppe D'Angelo

18 - Apr - 2021

Pavel

18 - Apr - 2021

Giuseppe D'Angelo

GiuseppeD'Angelo

Giuseppe D’Angelo

Senior Software Engineer