On Tue, 30 Sep 2014, Oleg Shparber wrote:

> 4. Is there a way to provide my own container type? Overloading [] with 
> Q_INVOKABLE does not work. I'd like to have a custom buffer type which I 
> can use as myBuffer[index].

[] is not a function in JavaScript. It's a property access. a[b] equates 
to a.b (leaving the type and possible values of 'b' aside).

With the regular QObject slot and property based approach you might not be 
able to model such a random index access. But how about you implement a 
thin wrapping layer in JavaScript? Through __defineGetter_ you should be 
able to forward property access attempts to a C++ slot internally.

Harri.
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to