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

QML signals don't send data when debugging and local variable is defined in the slot of another Component.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.11.0
    • Fix Version/s: 5.11.1
    • Labels:
      None
    • Environment:
      Windows msvc2015 64 bit

      Qt 5.11.0

       
    • Commits:
      2f4b8f159545b545d4b49cb3c1429c09522519ee

      Description

      Description

      When I debug a QtQuick application and catch a signal in another Component than the one the signal is send from, and have a local variable defined there, it doesn't send the data through, it is undefined. 

      As soon as I remove the local variable it works. I also tested it with Qt 5.10.1 and there is no problem there. 

      I attached an example application illustrating the issue. 

      Example

       Run with debugger:

      // Sending main.qml
      Window {
          id: mainWindow
      
          signal test(var data)
      
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
          Timer {
              id: mytimer
              interval: 1000; running: true; repeat: true
              onTriggered: test("knock knock")
          }
          Component.onCompleted: {
              mytimer.start()
          }
      
          TestComponent { }
      
          onTest: {
              var localVar
              console.debug(data)
          }
      }
      

       

      // Receiving TestComponent.qml
      Item {
          Connections {
              target: mainWindow
              onTest: {
                  var test // comment this out and it works (also modify the source of the signal to update cache), why though?
                  console.debug("test component: %1".arg(data)) // data is undefined!
              }
          }
      }
      

       

       

       

       

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              ulherman Ulf Hermann
              Reporter:
              jeroen_o Jeroen Oomkes
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes