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

Allow changing QQmlEngine's ownership heuristics

    XMLWordPrintable

Details

    Description

      Currently, it can be difficult to port a large Qt Script code base to QQmlEngine because of different default ownership rules.

      QScriptEngine uses QScriptEngine::QtOwnership by default (similar to QQmlEngine::CppOwnership), but QQmlEngine uses a more complex heuristic to determine ownership by default.

      A way to override the default heuristics can make porting easier.

       

      Use-case

      A customer's existing code is designed to pass numerous C++ objects to JavaScript via Q_INVOKABLE methods. QScriptEngine does not take ownership of these objects, but QQmlEngine does – this causes the objects to be destroyed prematurely.

      The customer wants to minimize changes to their existing code by preventing QQmlEngine from taking ownership of the return values of Q_INVOKABLE methods by default.

      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
            skoh-qt Sze Howe Koh
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes