Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. TypeError: Can't call meta function because I have no idea how to handle QRemoteObjectSourceLocation
Forum Updated to NodeBB v4.3 + New Features

TypeError: Can't call meta function because I have no idea how to handle QRemoteObjectSourceLocation

Scheduled Pinned Locked Moved Unsolved Qt for Python
1 Posts 1 Posters 177 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    Uwe Kindler
    wrote on 8 Mar 2024, 14:12 last edited by
    #1

    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 type QRemoteObjectSourceLocation 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, that QRemoteObjectRegsitry 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 no QRemoteObjectSourceLocation type. So is this a bug or is there any way to connect to this signal in Python?

    Thank you.

    1 Reply Last reply
    0

    1/1

    8 Mar 2024, 14:12

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved