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 'std::string' (Make sure 'std::string' is registered using qRegisterMetaType().)
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 6.4k Views 1 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.
  • R Offline
    R Offline
    reddy9pp
    wrote on 19 Feb 2020, 11:35 last edited by
    #1

    I encounter this error when doing Signal-Slot method.

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

    How could I resolve this?

    J 1 Reply Last reply 19 Feb 2020, 11:36
    0
    • R reddy9pp
      19 Feb 2020, 11:35

      I encounter this error when doing Signal-Slot method.

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

      How could I resolve this?

      J Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 19 Feb 2020, 11:36 last edited by
      #2

      @reddy9pp
      like the error says, register it to the methadones system via qRegisterMetaType or easier, use QString


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      R 1 Reply Last reply 19 Feb 2020, 11:45
      5
      • J J.Hilk
        19 Feb 2020, 11:36

        @reddy9pp
        like the error says, register it to the methadones system via qRegisterMetaType or easier, use QString

        R Offline
        R Offline
        reddy9pp
        wrote on 19 Feb 2020, 11:45 last edited by
        #3

        @J-Hilk

        mainWindow.h

        public:
            void  A(std:string data);
        signals:
            void dataReceived(std:string data);
        private slots:
            void B(std:string data);
        private:
            Ui::MainWindow *ui;
        

        How could I do this without the use of QString?
        I also have to implement for cv::Mat type data

        P V 2 Replies Last reply 19 Feb 2020, 12:21
        0
        • R reddy9pp
          19 Feb 2020, 11:45

          @J-Hilk

          mainWindow.h

          public:
              void  A(std:string data);
          signals:
              void dataReceived(std:string data);
          private slots:
              void B(std:string data);
          private:
              Ui::MainWindow *ui;
          

          How could I do this without the use of QString?
          I also have to implement for cv::Mat type data

          P Offline
          P Offline
          Pl45m4
          wrote on 19 Feb 2020, 12:21 last edited by Pl45m4
          #4

          @reddy9pp

          How to register metatypes is explained here. Look at the Block - example.
          https://doc.qt.io/qt-5/custom-types.html#creating-and-destroying-custom-objects


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

          ~E. W. Dijkstra

          1 Reply Last reply
          5
          • R reddy9pp
            19 Feb 2020, 11:45

            @J-Hilk

            mainWindow.h

            public:
                void  A(std:string data);
            signals:
                void dataReceived(std:string data);
            private slots:
                void B(std:string data);
            private:
                Ui::MainWindow *ui;
            

            How could I do this without the use of QString?
            I also have to implement for cv::Mat type data

            V Offline
            V Offline
            VRonin
            wrote on 20 Feb 2020, 11:14 last edited by
            #5

            @reddy9pp said in QObject::connect: Cannot queue arguments of type 'std::string' (Make sure 'std::string' is registered using qRegisterMetaType().):

            I also have to implement for cv::Mat type data

            Be very careful as cv::Mat is not implicitly shared, it is just shared (i.e. a copy of a cv::Mat object will point to the same data as the copied from item) so it might cause problems if you try to queue arguments of that tipe

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            1 Reply Last reply
            5

            1/5

            19 Feb 2020, 11:35

            • Login

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