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

Mixing old and new Connections syntax has weird effect

    XMLWordPrintable

Details

    Description

      When mixing old and new Connections syntax only the old version is working.

      qrc:/qt/qml/untitled19/Main.qml:15:5: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
      qml: onReleased QQuickKeyEvent(0x556b299407d8)
      qml: onReleased QQuickKeyEvent(0x556b299407d8)
      qml: onReleased QQuickKeyEvent(0x556b299407d8)
      ...
      
      import QtQuick
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Rectangle {
              id: rectangle
              anchors.fill: parent
              Component.onCompleted: rectangle.forceActiveFocus()
          }
      
          Connections {
              target: rectangle.Keys
      
              function onPressed(event) {
                  console.log("function onPressed", event)
              }
              //function onReleased(event)  {
              //    console.log("function onReleased", event)
              //}
      
              onReleased: function(event) {
                  console.log("onReleased", event)
              }
          }
      }
      

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            henning Henning Gründl
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes