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

ComboBox: binding loop for Material.foreground

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.8.0 RC
    • 5.8.0 Beta
    • Quick: Controls 2
    • None
    • 3ea7f91d9bb0e74f1c49384019f22d55b2fb6263

    Description

      <Unknown File>: QML : Binding loop detected for property "foreground"
      <Unknown File>: QML : Binding loop detected for property "foreground"
      

      In the following example, only the non-flat dark ComboBoxes are triggering the binding loop, but the rest are included just to make sure that the potential fix doesn't break the other foreground conditions.

      import QtQuick 2.6
      import QtQuick.Controls 2.0
      import QtQuick.Controls.Material 2.0
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
      
          header: ToolBar {
              Row {
                  spacing: 20
                  ComboBox {
                      model: ["Light"]
                  }
                  ComboBox {
                      flat: true
                      model: ["Flat Light"]
                  }
                  ComboBox {
                      model: ["Dark"]
                      Material.theme: Material.Dark // <==
                  }
                  ComboBox {
                      flat: true
                      model: ["Flat Dark"]
                      Material.theme: Material.Dark
                  }
              }
          }
      
          Row {
              anchors.centerIn: parent
              Pane {
                  Column {
                      spacing: 20
                      ComboBox {
                          model: ["Light"]
                      }
                      ComboBox {
                          flat: true
                          model: ["Flat Light"]
                      }
                  }
              }
              Pane {
                  Material.theme: Material.Dark
                  Column {
                      spacing: 20
                      ComboBox { // <==
                          model: ["Dark"]
                      }
                      ComboBox {
                          flat: true
                          model: ["Flat Dark"]
                      }
                  }
              }
          }
      }
      

      For some reason, it happens to work in 5.7 with

      Material.foreground: Material.foreground === Material.toolTextColor ? undefined : Material.foreground
      

      But no longer in 5.8:

      Material.foreground: flat ? undefined : Material.foreground
      

      Notice that changing that line back to how it was in 5.7 doesn't solve the binding loop. Both branches are broken. We must not bind a property to itself.

      Attachments

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              jpnurmi J-P Nurmi
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes