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. Type argument of Q_DECLARE_METATYPE(T*) must be fully defined

Type argument of Q_DECLARE_METATYPE(T*) must be fully defined

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 2.9k 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.
  • A Offline
    A Offline
    Ania
    wrote on 27 Sept 2017, 02:12 last edited by
    #1

    In main thread, I created another subthread, and the struct must be transfered to the subthread. Here is my Connect in the main thread:

    HeartThreadMsg::HeartThreadRequest threadReqMsg;
    threadReqMsg.set_ack_identity(1);
    qRegisterMetaType<HeartThreadMsg::HeartThreadRequest>("HeartThreadMsg::HeartThreadRequest");
    qRegisterMetaType<struct CDK::RRFramework>("struct CDK::RRFramework");
    emit operSig(m_RRFW, threadReqMsg);
    

    m_RRFW is a struct, but it is not fully defined, it defined like this:

    namespace CDK
    {
          struct RRFramework;
    }
    

    when I compile the application, it shows that Type argument of Q_DECLARE_METATYPE(T*) must be fully defined, if I do want to declare the struct, and the struct can not be fully defined, does anyone know how to solve this, or does there has other method?

    J 1 Reply Last reply 27 Sept 2017, 04:28
    0
    • A Ania
      27 Sept 2017, 02:12

      In main thread, I created another subthread, and the struct must be transfered to the subthread. Here is my Connect in the main thread:

      HeartThreadMsg::HeartThreadRequest threadReqMsg;
      threadReqMsg.set_ack_identity(1);
      qRegisterMetaType<HeartThreadMsg::HeartThreadRequest>("HeartThreadMsg::HeartThreadRequest");
      qRegisterMetaType<struct CDK::RRFramework>("struct CDK::RRFramework");
      emit operSig(m_RRFW, threadReqMsg);
      

      m_RRFW is a struct, but it is not fully defined, it defined like this:

      namespace CDK
      {
            struct RRFramework;
      }
      

      when I compile the application, it shows that Type argument of Q_DECLARE_METATYPE(T*) must be fully defined, if I do want to declare the struct, and the struct can not be fully defined, does anyone know how to solve this, or does there has other method?

      J Online
      J Online
      jsulm
      Lifetime Qt Champion
      wrote on 27 Sept 2017, 04:28 last edited by
      #2

      @Ania You need to call qRegisterMetaType somewhere where the struct is fully defined.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply 9 Jan 2019, 09:20
      2
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 27 Sept 2017, 10:18 last edited by
        #3

        Hi,

        To add to @jsulm, you should use the version of qRegisterMetaType without argument. The one you are using is useful only for registering alias types.

        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
        1
        • J jsulm
          27 Sept 2017, 04:28

          @Ania You need to call qRegisterMetaType somewhere where the struct is fully defined.

          S Offline
          S Offline
          sanojsubran
          wrote on 9 Jan 2019, 09:20 last edited by
          #4

          @jsulm Do you mean in the header, where the struct is defined?

          I am also facing the same issue. Any help would be appreciated.

          J 1 Reply Last reply 9 Jan 2019, 11:50
          0
          • S sanojsubran
            9 Jan 2019, 09:20

            @jsulm Do you mean in the header, where the struct is defined?

            I am also facing the same issue. Any help would be appreciated.

            J Online
            J Online
            jsulm
            Lifetime Qt Champion
            wrote on 9 Jan 2019, 11:50 last edited by
            #5

            @sanojsubran said in Type argument of Q_DECLARE_METATYPE(T*) must be fully defined:

            Do you mean in the header, where the struct is defined?

            Somewhere in your code where the definition of the struct is known.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 9 Jan 2019, 22:33 last edited by
              #6

              To add to @jsulm, it's pretty usual to have that macro at the bottom of the header where the class/struct is defined.

              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

              • Login

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