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. QObject::connect: Cannot queue arguments of type 'xxx&'(Make sure 'xxx&' is registered using qRegisterMetaType().)

QObject::connect: Cannot queue arguments of type 'xxx&'(Make sure 'xxx&' is registered using qRegisterMetaType().)

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 5 Posters 5.5k Views 3 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.
  • O Offline
    O Offline
    opengpu2
    wrote on last edited by
    #1

    QObject::connect: Cannot queue arguments of type 'xxx&'
    (Make sure 'xxx&' is registered using qRegisterMetaType().)

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi,

      what is the question?
      Can you show your code?

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      O 1 Reply Last reply
      0
      • M mcosta

        Hi,

        what is the question?
        Can you show your code?

        O Offline
        O Offline
        opengpu2
        wrote on last edited by opengpu2
        #3

        @mcosta QObject::connnect(), the signal and slot i use signal(const xxx&)
        xxx is the param type

        and i saw the warning above in the VS output...

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on last edited by
          #4

          what xxx is??

          if you are using a custom type you have to register it to be used in MetaType system

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          O 1 Reply Last reply
          0
          • M mcosta

            what xxx is??

            if you are using a custom type you have to register it to be used in MetaType system

            O Offline
            O Offline
            opengpu2
            wrote on last edited by
            #5

            @mcosta xxx is my own Class

            O 1 Reply Last reply
            0
            • O opengpu2

              @mcosta xxx is my own Class

              O Offline
              O Offline
              opengpu2
              wrote on last edited by
              #6

              @opengpu2 how to register it? i did not register...and it seems to work fine...

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mcosta
                wrote on last edited by
                #7

                To register a custom type you have to use qRegisterMetaType(). You need to use it if you use QueuedConnection.

                Read here for more details

                Once your problem is solved don't forget to:

                • Mark the thread as SOLVED using the Topic Tool menu
                • Vote up the answer(s) that helped you to solve the issue

                You can embed images using (http://imgur.com/) or (http://postimage.org/)

                O 1 Reply Last reply
                0
                • M mcosta

                  To register a custom type you have to use qRegisterMetaType(). You need to use it if you use QueuedConnection.

                  Read here for more details

                  O Offline
                  O Offline
                  opengpu2
                  wrote on last edited by opengpu2
                  #8

                  @mcosta yeh, the sender and reciever are in 2 threads, so its AutoConnection is QueuedConnection

                  is my own custom Class must have defalut constructor?
                  what should i do if my Class only have constructor with param?

                  1 Reply Last reply
                  0
                  • nandN Offline
                    nandN Offline
                    nand
                    wrote on last edited by
                    #9

                    I too faced with same situation..
                    code:@{
                    connect(serial,SIGNAL(func(cv::String,cv::Mat,QTextStream&)),this,SLOT(func(cv::String,cv::Mat,QTextStream&)));
                    }@
                    Error:
                    Cannot queue arguments of type 'QTextstream&'

                    I got same error for cv::string & cv::Mat but i resolved it using:
                    qRegisterMetaType< cv::Mat >("cv::Mat");
                    qRegisterMetaType< cv::String >("cv::String");
                    but am unable to fix it for QTextstream&
                    Would you please help me here?

                    1 Reply Last reply
                    1
                    • mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by mrjj
                      #10

                      @nand said:

                      Cannot queue arguments of type 'QTextstream&'

                      Have you tried with QTextstream*'
                      just to see if it like that `?

                      Edit:
                      It solved the issue.

                      1 Reply Last reply
                      0
                      • jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Actually there is no need for & in the connect() call. Just remove it.

                        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