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

QWebChannel does not support overloaded methods

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.14.0 Alpha
    • 5.12.0
    • WebChannel
    • None
    • 7a673eb1a6902ef6f2eb03d6beab139282b1e4a5 (qt/qtwebchannel/dev)

    Description

      QWebChannel does not support overloaded method invocation at the moment. It even says so in the source code:

      qmetaobjectpublisher.cpp:184:

      // optimize: skip overloaded methods/signals or property getters, on the JS side we can only
       // call one of them anyways
       // TODO: basic support for overloaded signals, methods

      Unfortunately, this isn't mentioned in the documentation. The note about being able to only call one of them from JS is only true because of the restricted implementation. There's nothing in JS preventing us to call the method with a different number of arguments.

      Implementing overloaded method invocation should be rather easy by using QMetaObject::invoke() instead of QMetaMethod::invoke(). The former does overload resolution internally, while the latter only works on a concrete method (i.e. after resolution).

      Attachments

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

        Activity

          People

            milianw Milian Wolff
            msarehn Arno Rehn
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes