Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-137704

A mechanism to temporarily pause the propagation of QML bindings

    XMLWordPrintable

Details

    Description

      Customer request

      Suppose I have a component that provides a layout based on 3 properties. (e.g. a size, a color and a font size).

      Suppose that these values are provided by a backend (or a config file) that is read or received into a settings component that updates global size, color and font properties which get picked up by this component using bindings.

      Now, when you get new values, passing the values (e.g from a WebSocket message) to the global properties, you trigger 3 updates. Moreover, that component might have property values that are invalid because all the received property values might interact. This could result in warning messages for undefined/invalid values, or your GUI might flicker due to unnecessary intermediate updates.

      Hence, a method to hold the binding trigger until the last value is updated might eliminate all of the above issues. Something like:

      Qt.delayBinding(true)
      p1 = v1 // sets property value, flags for dirty and queues the propagation
      p2 = v2 // sets property value, flags for dirty and queues the propagation
      // ...
      Qt.delayBinding(false) // triggers the propagation
      

       

      Alternative suggestion
      If delayed propagation of specific bindings is not feasible, then perhaps there could be an equivalent of QObject::blockSignals(), paired with a function to force re-evaluation of all bindings?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtqmlteam Qt Qml Team User
            skoh-qt Sze Howe Koh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes