[PySide] [Interest] error when trying to emit custom object via QObject.Signal
Frank Rueter | OHUfx
frank at ohufx.com
Tue Aug 28 00:40:32 CEST 2018
it looks like simply declaring "object" as the signal type makes it work.
Not sure if this is one of those things that PySide just makes easier,
which might be the reason why I haven't found any info or examples on
how to "register on meta type" with it.
I'm curious about this but need to press on with a delivery.
Thanks for your answer, I will try and get into the docs for QMetaObject
some more later to see if there is a better way to handle my case.
On 28/08/18 1:06 AM, Jérôme Godbout wrote:
> You will probably need to have the object declared to the meta type
> (sorry I don't known the call, but there must be one into PySide 2,
> you might want to dig into the doc near this
> https://doc.qt.io/qtforpython/PySide2/QtCore/QMetaObject.html ) and
> ideally be copiable since you will send the signal from another thread
> (from your QRunnable). So the signal will probably be queued adn
> therefore will need to copy the arguments to the signals.
> On Mon, 27 Aug 2018 at 05:14, Frank Rueter | OHUfx <frank at ohufx.com
> <mailto:frank at ohufx.com>> wrote:
> Hi all,
> I am trying to emit a custom object via QObject.Signal from inside
> a QRunnable.
> The object I am trying to emit throws this error:
> TypeError: Value types used on meta functions (including
> signals) need to be registered on meta type:
> I tried to trick it by creating a wrapper class like so
> |class NodeItem(QtCore.QObject): def __init__(self, node, clip):
> QtCore.QObject.__init__(self) self.node = node self.clip = clip |
> But that crashes the app when I try to emit it from a QRunnable,
> even though it works i the main thread.
> I have tried to find information on how to register meta types but
> cn only find C++ info about Q_DECLARE_METATYPE.
> This does not seem to exist in Python land though?!
> Does anybody have any ideas? I’m kinda stuck with this one.
> ohufxLogo 50x50 <http://www.ohufx.com>
> *vfx compositing <http://ohufx.com/compositing.html> | *workflow
> customisation and consulting <http://ohufx.com/customising.html>* *
> Your gateway to over 1,000 free tools... right inside of Nuke
> Interest mailing list
> Interest at qt-project.org <mailto:Interest at qt-project.org>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PySide