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

QJSEngine/QQmlEngine: Support calling C++ static member functions, namespaced functions, and/or standalone functions

    XMLWordPrintable

Details

    Description

      QScriptable allows us to expose C++ classes with static and non-static methods to JavaScript.

      var obj = new Class();
      obj.nonStaticMethod();
      Class.staticMethod();
      

      However, with QQmlEngine, we can only call C++ instance member functions from JavaScript.

      Current related deficiencies:

      • Q_INVOKABLE does not work with static member functions
      • Q_INVOKABLE does not work with Q_NAMESPACE
      • There is no equivalent of QScriptEngine::newFunction (QTBUG-45246 )
      • QQmlEngine does not let us instantiate C++ objects using JavaScript `new` (QTBUG-103461)

      Attachments

        Issue Links

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

          Activity

            People

              qtqmlteam Qt Qml Team User
              skoh-qt Sze Howe Koh
              Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes