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

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

    XMLWordPrintable

Details

    • 33c13102b (dev)

    Description

      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)

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes