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

"var" and "variant" type properties emit valueChanged signal even when value remains unchanged

XMLWordPrintable

    • 33c13102b (dev)

      Code

      import QtQuick.Controls.Basic
      
      ApplicationWindow {
          id: root
          width: 640
          height: 480
          visible: true
      
          property int intVal: swt.checked ? 100 : 100
          property var varVal: swt.checked ? 100 : 100
      
          onIntValChanged: console.log("intValChanged:", root.intVal)
          onVarValChanged: console.log("varValChanged:", root.varVal)
      
          Switch { id: swt }
      }
      

       

      Steps to reproduce

      1. Run the code above
      2. Toggle the switch multiple times

       

      Outcomes
      Each time the switch is toggled...

      • ...we see "varValChanged: 100" (Not Expected)
      • ...we don't see "intValChanged" (Expected)

        For Gerrit Dashboard: QTBUG-131901
        # Subject Branch Project Status CR V

            ulherman Ulf Hermann
            skoh-qt Sze Howe Koh
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes