Unsolved PyQt5 Register Meta type
-
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. -
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
-
@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? -
This post is deleted! -
@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
-
@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. -
@JonB PyQt5/PySide2 is limited and yes: there are many things that cannot be done.
-
thanks to both @eyllanesc and @JonB for your answers. Yes @eyllanesc I agree with you I Did modify the GUI With Another Thread.