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. When are QML property bindings evaluated when the binding is to a function?
Forum Updated to NodeBB v4.3 + New Features

When are QML property bindings evaluated when the binding is to a function?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 507 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
    greenroom
    wrote on last edited by greenroom
    #1

    For example,

    Button {
    ...
    enabled: isEnabled()
    ...

    function isEnabled() {
    return (complex boolean and other function calls)
    }
    }

    When does isEnabled get evaluated? What if isEnabled is defined outside of the Button?

    1 Reply Last reply
    0
    • Shrinidhi UpadhyayaS Offline
      Shrinidhi UpadhyayaS Offline
      Shrinidhi Upadhyaya
      wrote on last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      -1
      • J.HilkJ Online
        J.HilkJ Online
        J.Hilk
        Moderators
        wrote on last edited by J.Hilk
        #3

        @Shrinidhi-Upadhyaya said in When are QML property bindings evaluated when the binding is to a function?:

        the function will get called only when you invoke them

        that is partially incorrect. When the "function" contains properties and the return value is bound to an other property, like the op posted, then that function is reevaluated as soon as any of the properties changes.

        Additionally to that it is one time evaluated on the start/creation of the QML-object


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        3

        • Login

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