Hi all,

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. For example, one of my set of methods is:

- i18n
- i18nc
- i18np

Each one of these methods have a second overloaded version of them, to
accept more parameters for example. Just making the overloaded methods
being slots does not solve the issue and overloading slots has some
problems like breaking badly with default arguments.

At this time, to export this to QML I needed to create a QObject with
6 slots (one slot for each overloaded version of the method).

- i18n
- i18na

- i18nc
- i18nca

- i18np
- i18npa

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

and opened a JIRA request for this:
http://bugreports.qt.nokia.com/browse/QTBUG-11529

(if you think you need this feature for some use cause that you have,
vote for it)


Thanks and best regards,

-- 
-------------------------------------------------------
Artur Duque de Souza
openBossa
INdT - Instituto Nokia de Tecnologia
-------------------------------------------------------
Blog: http://labs.morpheuz.eng.br/blog/
PGP: 0xDBEEAAC3 @ wwwkeys.pgp.net
-------------------------------------------------------
_______________________________________________
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to