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

QML Synchronizer: add `enabled` property

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: Not Evaluated Not Evaluated
    • None
    • 6.10.0
    • Quick: Other
    • None

      Thanks for the new Synchronizer! It's very helpful. However, there was a pattern I was using with Bindings/Connections that I'm trying to replace with Synchronizer. I only want the synchronization to be "active" (or "enabled", whatever you decide to call it) when another property is true. This seems like an API that should be there.

      Here's my example use case that I wish to replace with a synchronizer:

      Unable to find source-code formatter for language: qml. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
        Binding {
            property: "contentY"
            target: scrollView.contentItem
            value: root.editorSettings.y
            when: root.enableYScroll
          }
      
          Connections {
            function onContentYChanged() {
              root.editorSettings.y = scrollView.contentItem.contentY;
            }
      
            enabled: root.enableYScroll
            target: scrollView.contentItem
          }
      

      As you can see I'm doing (probably badly) manual synchronization on a condition. I would like to be able to do the following:

      Unable to find source-code formatter for language: qml. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
          Synchronizer {
            sourceObject: root.editorSettings
            sourceProperty: "y"
            targetObject: scrollView.contentItem
            targetProperty: "contentY"
            enabled: root.enableYScroll // new property
          }
      

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            alextee Alexandros Theodotou
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes