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

Unable to access the changed signal paramter when using a Connections type in QML

    XMLWordPrintable

Details

    • All

    Description

      When using a Connections type in QML I'm unable to access the signal parameter:
      import QtQuick 2.12
      import QtQuick.Window 2.12

       

      import QtQuick 2.12
      import QtQuick.Window 2.12
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Box {
              id: box
              onExampleChanged: print("Box: ", example)
          }
      
          Connections {
              target: box
              function onExampleChanged(example) {
                  print("Connections: ", example)
              }
          }
      }
      

       

      // Box.qml

      import QtQuick 2.0
      
      Item {
          id:root
          property var example: "test"
          Timer {
              running: true
              onTriggered: root.example = "box"
          }
      }
      

       

      prints:

      qml: Box: box

      qml: Connections: undefined

       

      I find this strange (even a bug) because in c++ it always carries the changed value as parameter...

      Tested with Qt 5.15.2 and 6.0

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            kelteseth Elias Steurer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes