Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. PyQt5 Register Meta type
Qt 6.12 LTS is out! See what's new in the release blog

PyQt5 Register Meta type

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 3.9k Views
  • 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.
  • A Offline
    A Offline
    akshatrai91
    wrote on last edited by
    #1

    Hello,
    Can someone tell me about how to register a metatype in pyqt5. I created a
    multithreaded software and I am getting the warning says:
    (Make sure 'QVector<int>' is registered using qRegisterMetaType().)
    QObject::connect: Cannot queue arguments of type 'QVector<int>'
    (Make sure 'QVector<int>' is registered using qRegisterMetaType().)
    QObject::connect: Cannot queue arguments of type 'QVector<int>'
    then my software crashes suddenly.
    PLS give me an example of code for registering a new meta type.
    Thanks.

    1 Reply Last reply
    0
    • eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by eyllanesc
      #2

      Unable to register classes in pyqt, but I think you have an XY problem. I think you have implemented the application incorrectly so if you want help you should provide a minimal and reproducible example. See this post: https://stackoverflow.com/questions/2104779/qobject-qplaintextedit-multithreading-issues

      JonBJ eyllanescE 2 Replies Last reply
      1
      • eyllanescE eyllanesc

        Unable to register classes in pyqt, but I think you have an XY problem. I think you have implemented the application incorrectly so if you want help you should provide a minimal and reproducible example. See this post: https://stackoverflow.com/questions/2104779/qobject-qplaintextedit-multithreading-issues

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

        @eyllanesc
        Ignoring the OP's problem. Are you saying that from PyQt we cannot register meta types because we do not need to, because PyQt will sort out the meta-typing for us? So types will "work", we don't to register them, and the OP's message about unregistered type is only there because he must have something wrong?

        eyllanescE 1 Reply Last reply
        0
        • eyllanescE eyllanesc

          Unable to register classes in pyqt, but I think you have an XY problem. I think you have implemented the application incorrectly so if you want help you should provide a minimal and reproducible example. See this post: https://stackoverflow.com/questions/2104779/qobject-qplaintextedit-multithreading-issues

          eyllanescE Offline
          eyllanescE Offline
          eyllanesc
          wrote on last edited by
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • JonBJ JonB

            @eyllanesc
            Ignoring the OP's problem. Are you saying that from PyQt we cannot register meta types because we do not need to, because PyQt will sort out the meta-typing for us? So types will "work", we don't to register them, and the OP's message about unregistered type is only there because he must have something wrong?

            eyllanescE Offline
            eyllanescE Offline
            eyllanesc
            wrote on last edited by
            #5

            @JonB No, I did not say that, but it is a limitation of the wrapper. So my answer indicates that other methods should be used. For example the OP problem I suspect is caused because he wants to modify the GUI from another thread, and that is forbidden, so the correct solution is to use Qt signals

            JonBJ 1 Reply Last reply
            1
            • eyllanescE eyllanesc

              @JonB No, I did not say that, but it is a limitation of the wrapper. So my answer indicates that other methods should be used. For example the OP problem I suspect is caused because he wants to modify the GUI from another thread, and that is forbidden, so the correct solution is to use Qt signals

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

              @eyllanesc
              OK, so, maybe not for this OP, but there are some places where you would want to register a metatype from PyQt but cannot do so? There are some things you cannot do from Python/PyQt, or there would always be another way? I am just interested to understand.

              eyllanescE 1 Reply Last reply
              0
              • JonBJ JonB

                @eyllanesc
                OK, so, maybe not for this OP, but there are some places where you would want to register a metatype from PyQt but cannot do so? There are some things you cannot do from Python/PyQt, or there would always be another way? I am just interested to understand.

                eyllanescE Offline
                eyllanescE Offline
                eyllanesc
                wrote on last edited by eyllanesc
                #7

                @JonB PyQt5/PySide2 is limited and yes: there are many things that cannot be done.

                1 Reply Last reply
                1
                • A Offline
                  A Offline
                  akshatrai91
                  wrote on last edited by
                  #8

                  thanks to both @eyllanesc and @JonB for your answers. Yes @eyllanesc I agree with you I Did modify the GUI With Another Thread.

                  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
                  • Unsolved