Hi Robert, You've created your signal at the class level, so it is shared by all instances of Foo. What you want is the signal at the object level, so each instance holds its own signal. Do so by creating the signal in the __init__ method.
def __init__(self): QObject.__init__(self) self.sig = QtCore.signal(str) Nathan On Jul 23, 2013 11:09 AM, "Robert Schilling" <[email protected]> wrote: > Hi @ all, > > Consider following example: > > from PySide import QtCore > from PySide.QtCore import QObject > > class Foo(QObject): > > sig = QtCore.Signal(str) > > def __init__(self): > QObject.__init__(self) > > def emit(self): > self.sig.emit("1") > > x = Foo() > x.emit() > > This example doesn't work. When calling self.sig.emit("1") actually > Foo.emit() is invoked. > Testing this example works with PyQt (that's what I'm migrating from). > > Am I doing something wrong? How can I avoid this? > > Regards Robert > _______________________________________________ > PySide mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/pyside >
_______________________________________________ PySide mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/pyside
