Undo the setContextProperty



  • Can we undo the setContextProperty() operation ? I use setContextProperty to bind a particular property to the QML. I want to add a feature wherein I should be able to undo this binding "effect" dynamically ?

    thanks.



  • Within my team we talked about such a feature. If the Qt object is gone, the QML can try to access an invalid reference. It is the same as using a invalid pointer to an not existing object.
    From my point of view it is not necessary to handle this situation.
    What is your reason?



  • @CPP
    Export2QML *obj = new Export2QML;
    contxt->setContextProperty("abc",obj);
    viewer.show();
    contxt->setContextProperty("abc",NULL);@

    @QML

            if (abc != null) {
            abc.display();
            }else {
                console.log("Object is null")
            }@

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.