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

Acess to QML script engine or set own script engine for QML

    XMLWordPrintable

Details

    Description

      I have a set of methods in a class that has overloaded versions. In order to export them to QML I needed to create a QObject with one slot for each overloaded version.

      Just making the overloaded methods being slots does not solve the issue and overloading slots has some problems like breaking badly with default arguments. In order to export this to QML I needed to create a QObject with one slot for each overloaded version of the methods.

      In the past, as I have QtScript bindings for the same methods, I could properly handle this use case on the binding code (users on QtScript side just call the function and I check the number of arguments given and call the proper method, etc...).

      The problem is that currently there is no way of having access to the QML's script engine or even setting my own, what would solve all this issues and would enable me to even share more code and avoid duplication in my code base.

      I've heard that some reasons for not exporting the script engine are not letting the user mess with the globalObject and also due to optimizations. I can understand if you don't want people to mess with the globalObject in your "QML runtime" but as I am doing my own "QML runtime" and I'm at C++ level, I do want the flexibility of adding whatever I want to export to the QML side.

      What I propose to solve this issue is that if you don't want to export the QML's script engine, then enable a way of setting my own as by doing so I'm explicitly giving up on possible optimizations that would exist.

      I have also found some other use cases, like:
      http://lists.trolltech.com/pipermail/qt-qml/2010-June/000410.html

      Attachments

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

        Activity

          People

            aakenned Aaron Kennedy
            artsouza Artur de Souza (MoRpHeUz)
            Votes:
            8 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes