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
Forum Updated to NodeBB v4.3 + New Features

QObject::connect: Cannot queue arguments of type

Scheduled Pinned Locked Moved Solved General and Desktop
27 Posts 8 Posters 6.6k Views 4 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 micha_eleric
    27 Nov 2023, 02:57
    (int e, float a[], float b[]);
    

    gives

    QObject::connect: Cannot queue arguments of type 'float[]'
    (Make sure 'float[]' is registered using qRegisterMetaType().)
    
    (int e, qfloat16 a[], qfloat16 b[]);
    

    gives

    QObject::connect: Cannot queue arguments of type 'qfloat16[]'
    (Make sure 'qfloat16[]' is registered using qRegisterMetaType().)
    

    i want to pass a float array from one thread to another. neither float works. does qt not have a standard float array to pass?


    edit: guess i should have add more code, although more does not seem to explain error.
    class COne

    signals:
        void EmitScene(int i, QList<qfloat16> a, QList<qfloat16> b);
    
    int end;
    QList<qfloat16> A;
    QList<qfloat16> B;
    emit EmitScene(end, sceneA, sceneB);
    

    class connect1to2

    connect(m_one, &COne::EmitScene, m_two, &CTwo::ReceiveScene);
    

    class CTwo

    void CTwo::ReceiveScene(int e, QList<qfloat16> a, QList<qfloat16> b)
    
    H Offline
    H Offline
    HaoTian
    wrote on 27 Nov 2023, 03:29 last edited by
    #2

    @micha_eleric I suggest you to use a qt container rather than an array. and that will be work.

    Such as QList<float>.
    Because Qt have to store the args when you use queued connection type.

    M 1 Reply Last reply 27 Nov 2023, 04:15
    1
    • H HaoTian
      27 Nov 2023, 03:29

      @micha_eleric I suggest you to use a qt container rather than an array. and that will be work.

      Such as QList<float>.
      Because Qt have to store the args when you use queued connection type.

      M Offline
      M Offline
      micha_eleric
      wrote on 27 Nov 2023, 04:15 last edited by micha_eleric
      #3

      @HaoTian I get

      QObject::connect: Cannot queue arguments of type 'QList<float>'
      (Make sure 'QList<float>' is registered using qRegisterMetaType().)
      
      QObject::connect: Cannot queue arguments of type 'QList<qfloat16>'
      (Make sure 'QList<qfloat16>' is registered using qRegisterMetaType().)
      
      

      seems same issue

      C 1 Reply Last reply 27 Nov 2023, 04:38
      0
      • M micha_eleric
        27 Nov 2023, 04:15

        @HaoTian I get

        QObject::connect: Cannot queue arguments of type 'QList<float>'
        (Make sure 'QList<float>' is registered using qRegisterMetaType().)
        
        QObject::connect: Cannot queue arguments of type 'QList<qfloat16>'
        (Make sure 'QList<qfloat16>' is registered using qRegisterMetaType().)
        
        

        seems same issue

        C Offline
        C Offline
        ChrisW67
        wrote on 27 Nov 2023, 04:38 last edited by
        #4

        @micha_eleric The message will continue until you do what the error message advises and call qRegisterMetaType:

        int id = qRegisterMetaType< QList<float> >();
        

        somewhere early in the code execution before you try to use it.

        M 1 Reply Last reply 27 Nov 2023, 04:56
        1
        • C ChrisW67
          27 Nov 2023, 04:38

          @micha_eleric The message will continue until you do what the error message advises and call qRegisterMetaType:

          int id = qRegisterMetaType< QList<float> >();
          

          somewhere early in the code execution before you try to use it.

          M Offline
          M Offline
          micha_eleric
          wrote on 27 Nov 2023, 04:56 last edited by
          #5

          @ChrisW67

          int id = qRegisterMetaType< QList<float> >();
          

          is in both classes that use QList<float>, and still get the error

          H J 2 Replies Last reply 27 Nov 2023, 05:11
          0
          • M micha_eleric
            27 Nov 2023, 04:56

            @ChrisW67

            int id = qRegisterMetaType< QList<float> >();
            

            is in both classes that use QList<float>, and still get the error

            H Offline
            H Offline
            HaoTian
            wrote on 27 Nov 2023, 05:11 last edited by
            #6

            @micha_eleric No no, it's not necessary to register anything. because QList is automatically registered by Qt and basic types do not need to be registered either.

            C M 2 Replies Last reply 27 Nov 2023, 07:02
            0
            • H HaoTian
              27 Nov 2023, 05:11

              @micha_eleric No no, it's not necessary to register anything. because QList is automatically registered by Qt and basic types do not need to be registered either.

              C Offline
              C Offline
              ChrisW67
              wrote on 27 Nov 2023, 07:02 last edited by
              #7

              @HaoTian Indeed, you are correct. This, for example, works:

              #include <QCoreApplication>
              #include <QObject>
              #include <QList>
              #include <QDebug>
              #include <QTimer>
              
              class Object: public QObject {
                      Q_OBJECT
              public:
                      Object(QObject *p = nullptr): QObject(p) {
                              QTimer::singleShot(
                                              5000, this,
                                              [this]() { emit send(QList<float> { 0, 1.2, 2.3, 3.4 } ); }
                              );
                      };
                      ~Object() { }
              
              public slots:
                      void receive(QList<float> list) {
                              qDebug() << list;
                      }
              signals:
                      void send(QList<float> list);
              
              };
              
              
              int main(int argc, char **argv) {
                      QCoreApplication app(argc, argv);
              
                      Object *a = new Object(qApp);
                      Object *b = new Object(qApp);
                      QObject::connect(a, &Object::send, b, &Object::receive);
              
                      return app.exec();
              }
              
              #include "main.moc"
              

              So, @micha_eleric, what are you not telling us? Are there threads involved? Can you modify the example above to fail in the same way?

              S M 2 Replies Last reply 27 Nov 2023, 08:27
              2
              • M micha_eleric
                27 Nov 2023, 04:56

                @ChrisW67

                int id = qRegisterMetaType< QList<float> >();
                

                is in both classes that use QList<float>, and still get the error

                J Offline
                J Offline
                JonB
                wrote on 27 Nov 2023, 08:11 last edited by
                #8

                @micha_eleric
                First you should get your code compiling and running correctly as per @ChrisW67. You will need to use the Q_OBJECT macro., and you should use connect() syntax shown, not SIGNAL/SLOT() macros.

                But you may end up needing to reconsider your array/list arguments to the signal/slot. I assume you are signalling across threads. Qt will copy any arguments. If your array is "large" or if you intend to update the array in the slot (not just read from it) you may/will need to reconsider.

                M 1 Reply Last reply 27 Nov 2023, 20:58
                2
                • C ChrisW67
                  27 Nov 2023, 07:02

                  @HaoTian Indeed, you are correct. This, for example, works:

                  #include <QCoreApplication>
                  #include <QObject>
                  #include <QList>
                  #include <QDebug>
                  #include <QTimer>
                  
                  class Object: public QObject {
                          Q_OBJECT
                  public:
                          Object(QObject *p = nullptr): QObject(p) {
                                  QTimer::singleShot(
                                                  5000, this,
                                                  [this]() { emit send(QList<float> { 0, 1.2, 2.3, 3.4 } ); }
                                  );
                          };
                          ~Object() { }
                  
                  public slots:
                          void receive(QList<float> list) {
                                  qDebug() << list;
                          }
                  signals:
                          void send(QList<float> list);
                  
                  };
                  
                  
                  int main(int argc, char **argv) {
                          QCoreApplication app(argc, argv);
                  
                          Object *a = new Object(qApp);
                          Object *b = new Object(qApp);
                          QObject::connect(a, &Object::send, b, &Object::receive);
                  
                          return app.exec();
                  }
                  
                  #include "main.moc"
                  

                  So, @micha_eleric, what are you not telling us? Are there threads involved? Can you modify the example above to fail in the same way?

                  S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 27 Nov 2023, 08:27 last edited by
                  #9

                  @ChrisW67 said in QObject::connect: Cannot queue arguments of type:

                  @HaoTian Indeed, you are correct. This, for example, works:

                  #include <QCoreApplication>
                  #include <QObject>
                  #include <QList>
                  #include <QDebug>
                  #include <QTimer>
                  
                  class Object: public QObject {
                          Q_OBJECT
                  public:
                          Object(QObject *p = nullptr): QObject(p) {
                                  QTimer::singleShot(
                                                  5000, this,
                                                  [this]() { emit send(QList<float> { 0, 1.2, 2.3, 3.4 } ); }
                                  );
                          };
                          ~Object() { }
                  
                  public slots:
                          void receive(QList<float> list) {
                                  qDebug() << list;
                          }
                  signals:
                          void send(QList<float> list);
                  
                  };
                  
                  
                  int main(int argc, char **argv) {
                          QCoreApplication app(argc, argv);
                  
                          Object *a = new Object(qApp);
                          Object *b = new Object(qApp);
                          QObject::connect(a, &Object::send, b, &Object::receive);
                  
                          return app.exec();
                  }
                  
                  #include "main.moc"
                  

                  So, @micha_eleric, what are you not telling us? Are there threads involved? Can you modify the example above to fail in the same way?

                  If I may just add something: use const references, this will avoid potentially expensive copies when possible.

                  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
                  • H HaoTian
                    27 Nov 2023, 05:11

                    @micha_eleric No no, it's not necessary to register anything. because QList is automatically registered by Qt and basic types do not need to be registered either.

                    M Offline
                    M Offline
                    micha_eleric
                    wrote on 27 Nov 2023, 20:45 last edited by
                    #10

                    @HaoTian which is why I wonder why it gives this error when it runs

                    QObject::connect: Cannot queue arguments of type 'QList<float>'
                    (Make sure 'QList<float>' is registered using qRegisterMetaType().)
                    
                    1 Reply Last reply
                    0
                    • C ChrisW67
                      27 Nov 2023, 07:02

                      @HaoTian Indeed, you are correct. This, for example, works:

                      #include <QCoreApplication>
                      #include <QObject>
                      #include <QList>
                      #include <QDebug>
                      #include <QTimer>
                      
                      class Object: public QObject {
                              Q_OBJECT
                      public:
                              Object(QObject *p = nullptr): QObject(p) {
                                      QTimer::singleShot(
                                                      5000, this,
                                                      [this]() { emit send(QList<float> { 0, 1.2, 2.3, 3.4 } ); }
                                      );
                              };
                              ~Object() { }
                      
                      public slots:
                              void receive(QList<float> list) {
                                      qDebug() << list;
                              }
                      signals:
                              void send(QList<float> list);
                      
                      };
                      
                      
                      int main(int argc, char **argv) {
                              QCoreApplication app(argc, argv);
                      
                              Object *a = new Object(qApp);
                              Object *b = new Object(qApp);
                              QObject::connect(a, &Object::send, b, &Object::receive);
                      
                              return app.exec();
                      }
                      
                      #include "main.moc"
                      

                      So, @micha_eleric, what are you not telling us? Are there threads involved? Can you modify the example above to fail in the same way?

                      M Offline
                      M Offline
                      micha_eleric
                      wrote on 27 Nov 2023, 20:47 last edited by
                      #11

                      @ChrisW67 it is with threads, and the only place I have seen

                      QObject::connect: Cannot queue arguments of type 'QList<float>'
                      (Make sure 'QList<float>' is registered using qRegisterMetaType().)
                      

                      show while running

                      1 Reply Last reply
                      0
                      • J JonB
                        27 Nov 2023, 08:11

                        @micha_eleric
                        First you should get your code compiling and running correctly as per @ChrisW67. You will need to use the Q_OBJECT macro., and you should use connect() syntax shown, not SIGNAL/SLOT() macros.

                        But you may end up needing to reconsider your array/list arguments to the signal/slot. I assume you are signalling across threads. Qt will copy any arguments. If your array is "large" or if you intend to update the array in the slot (not just read from it) you may/will need to reconsider.

                        M Offline
                        M Offline
                        micha_eleric
                        wrote on 27 Nov 2023, 20:58 last edited by
                        #12

                        @JonB said in QObject::connect: Cannot queue arguments of type:

                        @micha_eleric
                        First you should get your code compiling and running correctly as per @ChrisW67. You will need to use the Q_OBJECT macro., and you should use connect() syntax shown, not SIGNAL/SLOT() macros.

                        But you may end up needing to reconsider your array/list arguments to the signal/slot. I assume you are signalling across threads. Qt will copy any arguments. If your array is "large" or if you intend to update the array in the slot (not just read from it) you may/will need to reconsider.

                        it compiles and runs, but

                        QObject::connect: Cannot queue arguments of type 'QList<float>'
                        (Make sure 'QList<float>' is registered using qRegisterMetaType().)
                        

                        shows on console while running

                        S 1 Reply Last reply 27 Nov 2023, 21:02
                        0
                        • M micha_eleric
                          27 Nov 2023, 20:58

                          @JonB said in QObject::connect: Cannot queue arguments of type:

                          @micha_eleric
                          First you should get your code compiling and running correctly as per @ChrisW67. You will need to use the Q_OBJECT macro., and you should use connect() syntax shown, not SIGNAL/SLOT() macros.

                          But you may end up needing to reconsider your array/list arguments to the signal/slot. I assume you are signalling across threads. Qt will copy any arguments. If your array is "large" or if you intend to update the array in the slot (not just read from it) you may/will need to reconsider.

                          it compiles and runs, but

                          QObject::connect: Cannot queue arguments of type 'QList<float>'
                          (Make sure 'QList<float>' is registered using qRegisterMetaType().)
                          

                          shows on console while running

                          S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 27 Nov 2023, 21:02 last edited by
                          #13

                          @micha_eleric Which version of Qt are you running ?

                          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 27 Nov 2023, 21:13
                          0
                          • S SGaist
                            27 Nov 2023, 21:02

                            @micha_eleric Which version of Qt are you running ?

                            M Offline
                            M Offline
                            micha_eleric
                            wrote on 27 Nov 2023, 21:13 last edited by
                            #14

                            @SGaist said in QObject::connect: Cannot queue arguments of type:

                            @micha_eleric Which version of Qt are you running ?

                            been asked this before, and still no clue how to find out. All I can find is the version of the editor.

                            C 1 Reply Last reply 27 Nov 2023, 21:20
                            0
                            • M micha_eleric
                              27 Nov 2023, 21:13

                              @SGaist said in QObject::connect: Cannot queue arguments of type:

                              @micha_eleric Which version of Qt are you running ?

                              been asked this before, and still no clue how to find out. All I can find is the version of the editor.

                              C Offline
                              C Offline
                              CPPUIX
                              wrote on 27 Nov 2023, 21:20 last edited by
                              #15

                              @micha_eleric said in QObject::connect: Cannot queue arguments of type:

                              how to find out

                              Which version of Qt am I using? How do I find out?

                              M 1 Reply Last reply 27 Nov 2023, 22:04
                              0
                              • C CPPUIX
                                27 Nov 2023, 21:20

                                @micha_eleric said in QObject::connect: Cannot queue arguments of type:

                                how to find out

                                Which version of Qt am I using? How do I find out?

                                M Offline
                                M Offline
                                micha_eleric
                                wrote on 27 Nov 2023, 22:04 last edited by
                                #16

                                @Abderrahmene_Rayene said in QObject::connect: Cannot queue arguments of type:

                                @micha_eleric said in QObject::connect: Cannot queue arguments of type:

                                how to find out

                                Which version of Qt am I using? How do I find out?

                                instructions do not work for my version of QT Create, and once i did find preference->kit->kit, nothing was listed under auto-detected nor manual

                                J 1 Reply Last reply 28 Nov 2023, 01:33
                                0
                                • M micha_eleric
                                  27 Nov 2023, 22:04

                                  @Abderrahmene_Rayene said in QObject::connect: Cannot queue arguments of type:

                                  @micha_eleric said in QObject::connect: Cannot queue arguments of type:

                                  how to find out

                                  Which version of Qt am I using? How do I find out?

                                  instructions do not work for my version of QT Create, and once i did find preference->kit->kit, nothing was listed under auto-detected nor manual

                                  J Offline
                                  J Offline
                                  JKSH
                                  Moderators
                                  wrote on 28 Nov 2023, 01:33 last edited by
                                  #17

                                  @micha_eleric said in QObject::connect: Cannot queue arguments of type:

                                  once i did find preference->kit->kit, nothing was listed under auto-detected nor manual

                                  That sounds very strange.

                                  What do you see when you try Step #2 in the instructions?

                                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                  M 1 Reply Last reply 28 Nov 2023, 02:04
                                  0
                                  • J JKSH
                                    28 Nov 2023, 01:33

                                    @micha_eleric said in QObject::connect: Cannot queue arguments of type:

                                    once i did find preference->kit->kit, nothing was listed under auto-detected nor manual

                                    That sounds very strange.

                                    What do you see when you try Step #2 in the instructions?

                                    M Offline
                                    M Offline
                                    micha_eleric
                                    wrote on 28 Nov 2023, 02:04 last edited by
                                    #18

                                    @JKSH said in QObject::connect: Cannot queue arguments of type:

                                    @micha_eleric said in QObject::connect: Cannot queue arguments of type:

                                    once i did find preference->kit->kit, nothing was listed under auto-detected nor manual

                                    That sounds very strange.

                                    What do you see when you try Step #2 in the instructions?

                                    lol, second step also gave no version, but can find editor version elsewhere
                                    Qt Creator 6.0.2
                                    Based on Qt 5.15.3 (GCC 11.2.0, 64 bit)

                                    Pl45m4P C 2 Replies Last reply 28 Nov 2023, 02:38
                                    0
                                    • M micha_eleric
                                      28 Nov 2023, 02:04

                                      @JKSH said in QObject::connect: Cannot queue arguments of type:

                                      @micha_eleric said in QObject::connect: Cannot queue arguments of type:

                                      once i did find preference->kit->kit, nothing was listed under auto-detected nor manual

                                      That sounds very strange.

                                      What do you see when you try Step #2 in the instructions?

                                      lol, second step also gave no version, but can find editor version elsewhere
                                      Qt Creator 6.0.2
                                      Based on Qt 5.15.3 (GCC 11.2.0, 64 bit)

                                      Pl45m4P Offline
                                      Pl45m4P Offline
                                      Pl45m4
                                      wrote on 28 Nov 2023, 02:38 last edited by Pl45m4
                                      #19

                                      @micha_eleric said in QObject::connect: Cannot queue arguments of type:

                                      Qt Creator 6.0.2
                                      Based on Qt 5.15.3 (GCC 11.2.0, 64 bit)

                                      This is meaningless. It's the Qt version which was used to build your QtCreator version.

                                      How are your build folders named? In some case they are named by default like:
                                      build_<Projectname>_<QtX_X_X>_<Compiler>_<Architecture>

                                      There you also can find out what Qt version you are using


                                      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                                      ~E. W. Dijkstra

                                      M 1 Reply Last reply 28 Nov 2023, 02:51
                                      0
                                      • Pl45m4P Pl45m4
                                        28 Nov 2023, 02:38

                                        @micha_eleric said in QObject::connect: Cannot queue arguments of type:

                                        Qt Creator 6.0.2
                                        Based on Qt 5.15.3 (GCC 11.2.0, 64 bit)

                                        This is meaningless. It's the Qt version which was used to build your QtCreator version.

                                        How are your build folders named? In some case they are named by default like:
                                        build_<Projectname>_<QtX_X_X>_<Compiler>_<Architecture>

                                        There you also can find out what Qt version you are using

                                        M Offline
                                        M Offline
                                        micha_eleric
                                        wrote on 28 Nov 2023, 02:51 last edited by
                                        #20

                                        @Pl45m4 said in QObject::connect: Cannot queue arguments of type:

                                        @micha_eleric said in QObject::connect: Cannot queue arguments of type:

                                        Qt Creator 6.0.2
                                        Based on Qt 5.15.3 (GCC 11.2.0, 64 bit)

                                        This is meaningless. It's the Qt version which was used to build your QtCreator version.

                                        How are your build folders named? In some case they are named by default like:
                                        build_<Projectname>_<QtX_X_X>_<Compiler>_<Architecture>

                                        There you also can find out what Qt version you are using

                                        again nothing of use, "build-GraphicsView-Desktop-Debug"

                                        M J 2 Replies Last reply 28 Nov 2023, 03:03
                                        0
                                        • M micha_eleric
                                          28 Nov 2023, 02:51

                                          @Pl45m4 said in QObject::connect: Cannot queue arguments of type:

                                          @micha_eleric said in QObject::connect: Cannot queue arguments of type:

                                          Qt Creator 6.0.2
                                          Based on Qt 5.15.3 (GCC 11.2.0, 64 bit)

                                          This is meaningless. It's the Qt version which was used to build your QtCreator version.

                                          How are your build folders named? In some case they are named by default like:
                                          build_<Projectname>_<QtX_X_X>_<Compiler>_<Architecture>

                                          There you also can find out what Qt version you are using

                                          again nothing of use, "build-GraphicsView-Desktop-Debug"

                                          M Offline
                                          M Offline
                                          micha_eleric
                                          wrote on 28 Nov 2023, 03:03 last edited by
                                          #21

                                          @micha_eleric well, after pecking around, i found:
                                          Qt 4.8.7 in PATH (qt4) /usr/lib/x86_64-linux-gnu/qt4/bin/qmake
                                          Qt 5.15.3 in PATH (qt5) /usr/lib/qt5/bin/qmake
                                          Qt 5.15.3 in PATH (System) /usr/bin/qmake

                                          1 Reply Last reply
                                          0

                                          11/27

                                          27 Nov 2023, 20:47

                                          • Login

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