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

Revisit "Allow signals forwarding in QML"

    XMLWordPrintable

Details

    Description

      I propose revisiting https://bugreports.qt.io/browse/QTBUG-9291

      1. It's received more interest over the years
      2. Since then, `ui.qml` has been introduced. In a ui.qml file, you even do simple forwarding like button.onClicked: root.clicked()–this triggers a warning and I believe it stops QDS. You must add a whole connections block to forward your signal.   

       

      Example situation: forward a signal in a .ui.qml file

      Current (4 lines of code, 6 physical lines of code, 1 new block):

      MyComplexComponent {
      signal leftButtonClicked(QtObject mouseEvent)
       .........
                MyDeeplyNestedButton  {
                   id: leftButton           
                 }
      
        Connections {
          target: leftButton
          function onClicked (mouseEvent)  {       
            leftButtonClicked(mouseEvent);     
          }
        }
      }
      

      Desired (1 line of code, no new blocks):

      MyComplexComponent  {
        signal alias leftButtonClicked: leftButton.clicked
       .........
                MyDeeplyNestedButton {
                   id: leftButton           
                }
      }
      

      And of course this shortcut is useful in standard qml, not just ui.qml!

      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
            mairtin.s Mairtin Steinkamp
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes