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. Cannot queue arguments of type...
Forum Updated to NodeBB v4.3 + New Features

Cannot queue arguments of type...

Scheduled Pinned Locked Moved Unsolved General and Desktop
21 Posts 9 Posters 10.1k 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.
  • EngelardE Engelard

    @VRonin Hey, that is good one feature, thanks.

    @jsulm said in Cannot queue arguments of type...:

    If you really want to use long long you need to register it first like the error message suggests.

    Why? I really can not understand, it's basic type which is often used by everyone everywhere, it's not some vector or some custom type... And i can't find single simple example for "qt register meta type" in google. I'd understood if i want to pass my custom type like struct or so, but it is essential type. qRegisterMetaType<signed long long>() - do nothing.

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #8

    @Engelard Actually from my own praxis I don't see long long used really often (and I guess this is the reason why this type isn't registered by default). In most cases a simple int is enough. Do you really need long long?

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

    1 Reply Last reply
    0
    • dheerendraD dheerendra

      Can you show how you have done qRegisterMetaType for signed long long ?

      EngelardE Offline
      EngelardE Offline
      Engelard
      wrote on last edited by Engelard
      #9

      @dheerendra

      There is quite nothing to show really
      In Header:

      Q_DECLARE_METATYPE(signed long long)
      

      CPP file(in constructor):

      qRegisterMetaType<signed long long>();
      

      @jsulm if such type would be unnecessary - it would not exist, i do need it because of big whole numbers which billions.

      jsulmJ 1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #10

        Try. qRegisterMetaType<signed long long>("signed long long");
        Check the complete example in my git repository

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        EngelardE 1 Reply Last reply
        6
        • dheerendraD dheerendra

          Try. qRegisterMetaType<signed long long>("signed long long");
          Check the complete example in my git repository

          EngelardE Offline
          EngelardE Offline
          Engelard
          wrote on last edited by Engelard
          #11

          @dheerendra said in Cannot queue arguments of type...:

          Try. qRegisterMetaType<signed long long>("signed long long");

          That is correct answer. But in previous topic someone told me that "leave parentheses empty"))

          P.S. i found that it working without macro, so only qRegisterMetaType<signed long long>("signed long long"); is enough

          1 Reply Last reply
          -1
          • EngelardE Engelard

            @dheerendra

            There is quite nothing to show really
            In Header:

            Q_DECLARE_METATYPE(signed long long)
            

            CPP file(in constructor):

            qRegisterMetaType<signed long long>();
            

            @jsulm if such type would be unnecessary - it would not exist, i do need it because of big whole numbers which billions.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by jsulm
            #12

            @Engelard said in Cannot queue arguments of type...:

            if such type would be unnecessary - it would not exist

            Where did I say it is unnecessary?!
            Please stay objective!

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

            1 Reply Last reply
            0
            • dheerendraD Offline
              dheerendraD Offline
              dheerendra
              Qt Champions 2022
              wrote on last edited by dheerendra
              #13

              @Engelard said in Cannot queue arguments of type...:

              P.S. i found that it working without macro, so only qRegisterMetaType<signed long long>("signed long long"); is enough

              hmmm. I did not see any body suggesting like this. Everybody suggested to use the qRegisterMetaType. I was suspecting the way you have done. Hence i asked the code.

              Dheerendra
              @Community Service
              Certified Qt Specialist
              http://www.pthinks.com

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

                @Engelard said in Cannot queue arguments of type...:

                That is correct answer. But in previous topic someone told me that "leave parentheses empty"))

                That someone explained you why as stated in the documentation of qRegisterMetatype.

                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
                3
                • dheerendraD Offline
                  dheerendraD Offline
                  dheerendra
                  Qt Champions 2022
                  wrote on last edited by
                  #15

                  Now your issue is fixed, you can move the issue to SOLVED state. It helps others.

                  Dheerendra
                  @Community Service
                  Certified Qt Specialist
                  http://www.pthinks.com

                  1 Reply Last reply
                  0
                  • SavithaS Offline
                    SavithaS Offline
                    Savitha
                    wrote on last edited by Savitha
                    #16

                    Hi All,

                    I know the solution has been provided to this problem but it is not working for me.

                    Here is my code,

                    Class2.hpp
                    void slot_ofClass2(quint32 &p_Result, QVector<quint32> &p_Values,
                    Error& p_error);

                    Class1.hpp
                    void signal_fromClass1(quint32& p_Result, QVector<quint32>& p_Values,
                    Error& p_error);

                    Class1.cpp

                        QObject::connect(this, &Class1::signal_fromClass1,
                                loc_class2Obj.data(), &Class2::slot_ofClass2,
                                Qt::QueuedConnection);
                    

                    I have added Q_DECLARE_METATYPE(quint32) in Class2.hpp which is included in Class1.hpp and
                    qRegisterMetaType<quint32>("quint32"); in both the Constructors of Class1 and Class2.

                    It is still giving the error"QObject::connect: Cannot queue arguments of type 'quint32&'
                    (Make sure 'quint32&' is registered using qRegisterMetaType().)"

                    What am I missing?

                    JonBJ 1 Reply Last reply
                    0
                    • SavithaS Savitha

                      Hi All,

                      I know the solution has been provided to this problem but it is not working for me.

                      Here is my code,

                      Class2.hpp
                      void slot_ofClass2(quint32 &p_Result, QVector<quint32> &p_Values,
                      Error& p_error);

                      Class1.hpp
                      void signal_fromClass1(quint32& p_Result, QVector<quint32>& p_Values,
                      Error& p_error);

                      Class1.cpp

                          QObject::connect(this, &Class1::signal_fromClass1,
                                  loc_class2Obj.data(), &Class2::slot_ofClass2,
                                  Qt::QueuedConnection);
                      

                      I have added Q_DECLARE_METATYPE(quint32) in Class2.hpp which is included in Class1.hpp and
                      qRegisterMetaType<quint32>("quint32"); in both the Constructors of Class1 and Class2.

                      It is still giving the error"QObject::connect: Cannot queue arguments of type 'quint32&'
                      (Make sure 'quint32&' is registered using qRegisterMetaType().)"

                      What am I missing?

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by JonB
                      #17

                      @Savitha
                      I don't know anything about QML/registering meta types, so no point quizzing me further, but looking at the error message and your signal/slot parameters you have registered quint32 but your methods require quint32&. With QML/register meta-type maybe it cannot go from quint32 to quint32&? If so, either register quint32& or change your parameters to quint32 to see if that works? There is little point in passing integer-types as references anyway. [Whoops, I didn't realize you are changing the value.]

                      SavithaS 1 Reply Last reply
                      0
                      • JonBJ JonB

                        @Savitha
                        I don't know anything about QML/registering meta types, so no point quizzing me further, but looking at the error message and your signal/slot parameters you have registered quint32 but your methods require quint32&. With QML/register meta-type maybe it cannot go from quint32 to quint32&? If so, either register quint32& or change your parameters to quint32 to see if that works? There is little point in passing integer-types as references anyway. [Whoops, I didn't realize you are changing the value.]

                        SavithaS Offline
                        SavithaS Offline
                        Savitha
                        wrote on last edited by
                        #18

                        @JonB Thank you for the reply.
                        If I change my parameters to quint32 it connects to the slot. But my slot_ofClass2 is updating these values which I will be handling in Class1 so I need quint32&.

                        If I try Q_DECLARE_METATYPE(quint32&) it gives error: 'type name' declared as a pointer to a reference of type 'quint32 &' (aka 'unsigned int &')
                        and qRegisterMetaType<quint32&>("quint32&"); gives error: no matching function for call to 'qRegisterMetaType<quint32&>(const char [9], quint32*)'

                        Any solution to handle this problem with references?

                        I have seen an example with (QString const& s) as a parameter and this works without having to register it as MetaType. So is there any workaround?

                        JonBJ 1 Reply Last reply
                        0
                        • SavithaS Savitha

                          @JonB Thank you for the reply.
                          If I change my parameters to quint32 it connects to the slot. But my slot_ofClass2 is updating these values which I will be handling in Class1 so I need quint32&.

                          If I try Q_DECLARE_METATYPE(quint32&) it gives error: 'type name' declared as a pointer to a reference of type 'quint32 &' (aka 'unsigned int &')
                          and qRegisterMetaType<quint32&>("quint32&"); gives error: no matching function for call to 'qRegisterMetaType<quint32&>(const char [9], quint32*)'

                          Any solution to handle this problem with references?

                          I have seen an example with (QString const& s) as a parameter and this works without having to register it as MetaType. So is there any workaround?

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by
                          #19

                          @Savitha
                          Did you try Q_DECLARE_METATYPE(quint32) as well as Q_DECLARE_METATYPE(quint32&)? Other than that you will have to await someone who knows about this.

                          SavithaS 1 Reply Last reply
                          0
                          • JonBJ JonB

                            @Savitha
                            Did you try Q_DECLARE_METATYPE(quint32) as well as Q_DECLARE_METATYPE(quint32&)? Other than that you will have to await someone who knows about this.

                            SavithaS Offline
                            SavithaS Offline
                            Savitha
                            wrote on last edited by
                            #20

                            @JonB Yes, I tried both together and it gave error for qRegisterMetaType<quint32&>("quint32&");

                            For now, I will emit one more signal from my Class2 and try to catch my results in a slot of Class1.

                            Thank you @JonB

                            1 Reply Last reply
                            0
                            • Christian EhrlicherC Offline
                              Christian EhrlicherC Offline
                              Christian Ehrlicher
                              Lifetime Qt Champion
                              wrote on last edited by
                              #21

                              A slot can not take non-const references. Especially not when it's a queued connection.

                              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                              Visit the Qt Academy at https://academy.qt.io/catalog

                              1 Reply Last reply
                              3

                              • Login

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