Qt Remote Objects (QtRO) is an Inter-Process Communication (IPC) module developed for Qt. This module extends Qt's existing functionalities to enable information exchange between processes or computers, easily.
One of Qt's key features, to enable this information exchange, is the distinction between an object's API (defined by its properties, signals, and slots) and the implementation of that API. QtRO's purpose is to meet that expected API, even if the true QObject is in a different process. A slot called on a copy of an object (the Replica in QtRO) is forwarded to the true object (the Source in QtRO) for handling. Every Replica receives updates to the Source, either property changes or emitted signals.
A Replica is a light-weight proxy for the Source object, but a Replica supports the same connections and behavior of QObjects, which makes it usable in the same way as any other QObject that Qt provides. Behind the scenes, QtRO handles everything that's necessary for the Replica to look like its Source.
Note that Remote Objects behave differently from traditional Remote Procedure Call (RPC) implementations, for example:
While it is possible to implement this RPC-style behavior in QtRO, as Sources without properties, and slots that have return values, QtRO hides the fact that the processing is really remote. You let a node give you the Replica instead of creating it yourself, possibly use the status signals (isReplicaValid()), but then interact with the object like you would with any other QObject-based type.
Consider a sensor such as a Global Positioning System (GPS) receiver. In QtRO terms:
Consider a service that provides access to a printer. In QtRO terms:
Using a Qt module requires linking against the module library, either directly or through other dependencies. Several build tools have dedicated support for this, including CMake and qmake.
Use the find_package()
command to locate the needed module components in the Qt6
package:
find_package(Qt6 REQUIRED COMPONENTS RemoteObjects)
See also the Build with CMake overview.
To configure the module for building with qmake, add the module as a value of the QT
variable in the project's .pro file:
QT += remoteobjects
Qt Remote Objects is available under commercial licenses from The Qt Company. In addition, it is available under the GNU Lesser General Public License, version 3, or the GNU General Public License, version 2. See Qt Licensing for further details.