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

SignalSpy.count returns wrong value

    XMLWordPrintable

Details

    Description

      If SignalSpy signalName property is defined before target property we can see that SignalSpy count property returns doubled value.

      See the only difference is order of target and signalName:

          SignalSpy {
              id: spySignalNameFirst
              signalName: "antialiasingChanged"
              target: rect
          }
      
          SignalSpy {
              id: spyTargetFirst
              target: rect
              signalName: "antialiasingChanged"
          }
      

      value of rect is changed in initTestCase only once:

          function initTestCase() {
            rect.antialiasing = true;
            console.log("spySignalNameFirst.count: " + spySignalNameFirst.count)
            console.log("spyTargetFirst.count: " + spyTargetFirst.count)
          }
      

      And output shows that value is different depending of the property order:

      QDEBUG : tst_testCase::myTest::initTestCase() qml: spySignalNameFirst.count: 2
      QDEBUG : tst_testCase::myTest::initTestCase() qml: spyTargetFirst.count: 1
      

      Test project for above test atached.

      If signal from rect is attached more than once it cause spySignalNameFirst.count value to be always double of the spyTrgetFirst.count value.

      Attachments

        Issue Links

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

          Activity

            People

              ulherman Ulf Hermann
              qtcomsupport Qt Support
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes