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

QML Signal handler is not called when signal overloads are used

    XMLWordPrintable

Details

    Description

      Attached a small example which exposes a C++ API to QML. The C++ API provides two signals:

      void somethingHappened(const QString& string);
      void somethingHappened(int number);
      

      The QString version is emitted after one second.

      On QML the signal is handled like this:

          SimpleAPI {
              onSomethingHappened: (argument) => {
                  console.log("QML", argument)
              }
          }
      

      The signal handler is never called. Changing the C++ code to emit both signals will call the QML handler. But only for the int version.

      Atleast in https://doc.qt.io/qt-6/qtqml-syntax-signals.html i couldn't find any other way to create the handler which works in both cases. (Or create another handler for the other signal).

      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
            gagi Dominik Holland
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes