Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Undo the setContextProperty
Forum Updated to NodeBB v4.3 + New Features

Undo the setContextProperty

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 888 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gautam
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      th.thielemann
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #3

        @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")
                }@
        

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved