TypeError: Can't call meta function because I have no idea how to handle QRemoteObjectSourceLocation
-
wrote on 8 Mar 2024, 14:12 last edited by
Hi,
I use QtRemoteObjects with PySide6. Everything works fine and I have no problem connecting to remote objects but I have a problem connecting a slot to the
QRemoteObjectRegistry.remoteObjectAdded(const QRemoteObjectSourceLocation &entry)
signal because the typeQRemoteObjectSourceLocation
is not known in PySide 6.This is my code:
self.m_Host = QRemoteObjectHost(QUrl('local:server'), QUrl('local:registry'), QRemoteObjectHost.BuiltInSchemasOnly, self) self.m_Host.registry().remoteObjectAdded.connect(self.onRemoteObjectAdded) @Slot(tuple) def onRemoteObjectAdded(self, loc : Tuple[str, PySide6.QtRemoteObjects.QRemoteObjectSourceLocationInfo]): print("onRemoteObjectAdded") return
If I execute the code, I get the following error:
TypeError: Can't call meta function because I have no idea how to handle QRemoteObjectSourceLocation
In C++ there is not problem connecting to the signal and the type
QRemoteObjectSourceLocation
is defined as follows:typedef QPair<QString, QRemoteObjectSourceLocationInfo> QRemoteObjectSourceLocation; Q_DECLARE_METATYPE(QRemoteObjectSourceLocation)
If I look into the provided
QtRemoteObjects.pyi
file, I can see, thatQRemoteObjectRegsitry
is defined as follows:class QRemoteObjectRegistry(PySide6.QtRemoteObjects.QRemoteObjectReplica): remoteObjectAdded : ClassVar[Signal] = ... # remoteObjectAdded(QRemoteObjectSourceLocation) remoteObjectRemoved : ClassVar[Signal] = ... # remoteObjectRemoved(QRemoteObjectSourceLocation) def addSource(self, entry: Tuple[str, PySide6.QtRemoteObjects.QRemoteObjectSourceLocationInfo]) -> None: ... def initialize(self) -> None: ... def pushToRegistryIfNeeded(self) -> None: ... @staticmethod def registerMetatypes() -> None: ... def removeSource(self, entry: Tuple[str, PySide6.QtRemoteObjects.QRemoteObjectSourceLocationInfo]) -> None: ... def sourceLocations(self) -> Dict[str, PySide6.QtRemoteObjects.QRemoteObjectSourceLocationInfo]: ...
The signal
remoteObjectAdded
is there but there is noQRemoteObjectSourceLocation
type. So is this a bug or is there any way to connect to this signal in Python?Thank you.
1/1