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 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.HilkJ 1 Reply Last reply
    0
    • R reddy9pp

      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.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on 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
      5
      • J.HilkJ J.Hilk

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

        R Offline
        R Offline
        reddy9pp
        wrote on 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

        Pl45m4P VRoninV 2 Replies Last reply
        0
        • R reddy9pp

          @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

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on 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

            @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

            VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on 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

            • Login

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