[Development] API Change in QtRemoteObjects

Stottlemyer, Brett (B.S.) bstottle at ford.com
Sat Jan 2 18:51:47 CET 2016


For those of you using the QtRemoteObjects playground module (QtRO for
short), some changes went in over the holidays that changed the public
API.  So you will need to update your code when you update to any version
of master past 16959709b59db45c07385ecc13b76061de851edf (or see the
(merged) review: https://codereview.qt-project.org/#/c/144624/).

>From the commit message:
> Convert Nodes to QObject based class(es)
> This change affects lots of lines of code, but is
> basically a refactoring, not changing much.  It
> does change the QtRO API, though.
> In the interest of making it easier to expose QtRO
> types to QML, the move to QObject types for Nodes was
> necessary.
> The static generators allowed for different "types²
> of Nodes to be created with different combinations of
> 1 or 2 QUrl parameters, but this also forced a Node
> type that had methods that might not make sense (for
> instance, enableRemoting() from a Node that wasn't a
> Host Node).  And Nodes needed to be copy-able.
> This change addresses those issues by creating
> three distinct types.  QRemoteObjectNode is
> the most basic type, and only supports acquiring
> Replica objects.  QRemoteObjectHost Nodes add the
> ability to share Source objects on the network.  Both
> Node and Host types support connecting to a Registry.
> QRemoteObjectRegistryHost Nodes host a Registry object
> other nodes can connect to.
> This change requires converting end-user code from
> the static functions (createHostNode, etc) to using
> the new types explicitly.
> Aside from the obvious change from static generator
> functions, there are two other impacts to user code:
> 1) connect() was renamed to connectToNode to not
> conflict with QObject's connect()
> 2) default QUrls for Hosting and Registry were removed
> (it was too easy to create name clashes with unexpected
> results).

Apologies for any inconvenience, but this will make QML integration
simpler, and makes the APIs more aligned with other Qt APIs.

Happy Holidays/Happy New Year!

More information about the Development mailing list