[Development] QtRemoteObjects (was Replicant)
Stottlemyer, Brett (B.S.)
bstottle at ford.com
Fri Oct 17 13:33:48 CEST 2014
On Friday 17 October 2014 11:31:10 Sumedha Widyadharma wrote:
> Do you think it would be possible to use run-time introspection à la QtWebChannel and dynamic signals/slots to get rid of the pre-processor?
I can't speak to QtWebChannel (trust Milian on that front), but I can speak to QtRemoteObjects. The functionality to point at has been incorporated into Qt via (private) QMetaObjectBuilder. This was a topic that was brought up at QtCS. We've incorporated the mechanism into QTRO, so you can indeed ask for an object as a Replica without using our compiler.
This does have some implications. Compile time type-safety is certainly part of a decision to use compiled vs. dynamic Replicas. Second, the repc compiler enables default values for properties. So you have the ability show something reasonable, even if the source object isn't available. For dynamic objects, you don't even know what properties are available until the Replica can be initialized from the Source object. Third, usage from C++ is a bit trickier as well, but less of a concern from QML. Finally, certain types need to be registered for use with stream operators. We can do this with the compiled Replicas, but not with dynamically created ones. Those are the big hitters off the top of my head.
So it really depends on the use-case whether QRemoteObjectDynamicReplica (yes, it is a mouthful - still like the old name better) is a good option over the compiled version. But the capability is already there.
If you go the route of dynamic Replicas, you can use QObject-derived types as the Source, and avoid the repc compiler entirely.
More information about the Development