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. Send a QObject with QDbus
Forum Updated to NodeBB v4.3 + New Features

Send a QObject with QDbus

Scheduled Pinned Locked Moved General and Desktop
qtdbus
6 Posts 2 Posters 1.8k Views 2 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.
  • M Offline
    M Offline
    marcosbontempo
    wrote on 2 Jun 2015, 11:45 last edited by
    #1

    Hello,

    I wrote a QDBus code able to send and receive QDBusMessage strings. Is there any way to send and receive QObjects too? What is the best way to encapsulate the transfered data ?

    Any tip will be very helpful.
    Thanks.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 2 Jun 2015, 23:01 last edited by
      #2

      Hi,

      You can find information about that here

      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

      M 1 Reply Last reply 3 Jun 2015, 14:33
      0
      • S SGaist
        2 Jun 2015, 23:01

        Hi,

        You can find information about that here

        Hope it helps

        M Offline
        M Offline
        marcosbontempo
        wrote on 3 Jun 2015, 14:33 last edited by marcosbontempo 6 Mar 2015, 14:36
        #3

        Hi @SGaist ,
        Thanks for answering. The link you sent me is exactly what I wanted!
        I'm trying to pass an object created in one of my classes as an argument.

        I have to declare my class with Q_DECLARE_METATYPE macro and call the function qRegisterMetaType, right? Do I have to use the Q_DECLARE_METATYPE macro in the class header?

        The examples are only for structs. I'm trying to do something similar with classes, but without sucess. Have you got an example? I'm a dummie with Qt.

        Thanks!

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 3 Jun 2015, 21:49 last edited by SGaist 6 Mar 2015, 21:50
          #4

          Q_DECLARE_METATYPE works with classes as well as struct you can follow the example all the same.

          Yes, declare your class and just under the declaration and before the endif call Q_DECLARE_METATYPE

          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
          • M Offline
            M Offline
            marcosbontempo
            wrote on 5 Jun 2015, 12:39 last edited by
            #5

            Thanks for the help @SGaist !
            I extended my type, but there was a restriction with QOBject classes. Can't I use any base class with the macro Q_DECLARE_METATYPE?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 5 Jun 2015, 14:04 last edited by
              #6

              You can't call Q_DECLARE_METATYPE(MyQObjectDerivedClass) because QObject is not a copyable class

              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

              3/6

              3 Jun 2015, 14:33

              • Login

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