Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDBusPendingReply: type(custom) not registered with QtDBus issue even when registered custom type it.
Qt 6.11 is out! See what's new in the release blog

QDBusPendingReply: type(custom) not registered with QtDBus issue even when registered custom type it.

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 2.0k Views 1 Watching
  • 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.
  • N Offline
    N Offline
    nitin
    wrote on last edited by nitin
    #1

    Hi,

    I am using an custom type which is Qlist of a structure. I am performing all the steps which are mentioned to register it but while executing i am getting runtime error "QDBusPendingReply: type Mylist not registered with QtDBus".
    Please find snippet of my code:-

    struct MyStruct
    {
    	quint8 a;
    	quint32 b;
    	double c;
    	quint32 d;
    };
    

    typedef QList<MyStruct> MyList;

    Q_DECLARE_METATYPE(MyStruct)
    Q_DECLARE_METATYPE(MyList)

    QDBusArgument &operator<<(QDBusArgument &, const MyStruct&);
    const QDBusArgument &operator>>(const QDBusArgument &, MyStruct&);

    QDBusArgument &operator<<(QDBusArgument &argument, const MyStruct &myStruct)
    {
    argument.beginStructure();
    argument << myStruct.a<< myStruct.b<< myStruct.c<< myStruct.d;
    argument.endStructure();
    return argument;
    }

    const QDBusArgument &operator>>(const QDBusArgument &argument, MyStruct &myStruct)
    {
    argument.beginStructure();
    argument >> myStruct.a>> myStruct.b>> myStruct.c>> myStruct.d;
    argument.endStructure();
    return argument;
    }

    void registerMetaTypes()
    {
    qDBusRegisterMetaType<MyStruct>();
    qDBusRegisterMetaType<MyList>();

    qRegisterMetaType<MyStruct>("MyStruct");
    qRegisterMetaType<MyList>("MyList");
    }

    I am facing error at below mentioned line in my code:-
    QDBusPendingReply<int, QList<MyStruct> > reply(*watch);

    Please suggest if any other change is required to be done.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I haven't used that module yet but one thing you should do is remove the string argument from your qRegisterMetaType calls. This version of the function is to register alias types.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nitin
        wrote on last edited by
        #3

        Even after removing that same issue exists.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          When are you calling these functions ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • N Offline
            N Offline
            nitin
            wrote on last edited by
            #5

            Hi,

            It was not getting called from anywhere. After calling registerMetaTypes() issue got resolved. Thanks for pointing it out.

            Thanks for you help.

            1 Reply Last reply
            1

            • Login

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