[Development] Switch Qt Remote Objects to a Tech Preview for Qt 5.9

Stottlemyer, Brett (B.S.) bstottle at ford.com
Wed Jan 11 14:54:11 CET 2017


On 1/11/17, 4:43 AM, "marc at kdab.com on behalf of Marc Mutz" <marc at kdab.com on behalf of marc.mutz at kdab.com> wrote:



>Hi Brett,
>
>On Wednesday 11 January 2017 01:42:38 Stottlemyer, Brett (B.S.) wrote:
>> With this picture in mind, the key to getting it to work is to hook into
>> qt_metacall and pass the invocations between processes.  This takes custom
>> code, so QtRO has repc (REPlica Compiler) for this.  It reads a .rep file,
>> a simple text format for describing the object’s API via Signals, Slot,
>> Properties and Enums, and generates a Qt header file for the Source and
>> Replica sides.  The mkspecs then add these files for moc to process.
>
>Speaking as someone who has almost no clue about QtRO, from an engineering 
>pov, it feels weird to have an easily-parsable representation of a 
>QMetaObject, then generate C++ code from it, and then use moc to parse the C++ 
>code to generate a QMetaObject. Wouldn't it be much simpler to generate the 
>moc files directly from the rep files (maybe even at runtime, with 
>QMetaObjectBuilder)?

Hi Marc.  I was not trying to give a comprehensive overview (that what docs
are for, right?) just trying to address Ossi’s comments.  QtRO does provide
for pushing a standard QObject out on the QtRO network and getting a “dynamic”
Replica of it without needing repc/moc.  But while this is possible, it is
a bit painful to work with.  The assumption is that the Replica is in a
different process than the QObject it represents.  The Replica will match the
API, but it needs extra plumbing and is a specific type (a mouthful,
QRemoteObjectDynamicReplica).  It can’t know anything about itself until it
gets information from QtRO about the object is should represent, and then you
need to (in code) look up the methods/properties from the runtime generated
metaobject.  There are no compile time checks against anything.  Works
reasonably well from QML, but as said, hard from C++.  The additional mkspecs
in QtRO hide the additional steps almost completely, and the generated code
provides better performance, the ability to have default values until the
connection is made, and type-safety.  Both options are available, though.

Regards,
Brett




More information about the Development mailing list