Provide QObject slots and signals features to another class?
-
Dear community,
I am currently expanding a class to change it's connections to use QNetwork.
So my code starts like this:@import PySide
import anotherLib
...class myClass(anotherLib.originalClass):
finished = QtCore.Signal(str)
error = QtCore.Signal(str)
def init(self,username,password):
super(myClass,self).init(username, password)
self.nam = QtNetwork.QNetworkAccessManager()
...
@QtCore.Slot()
def aMethod(self):
...
self.finished.emit('great')@I got an error: AttributeError: 'PySide.QtCore.Signal' object has no attribute 'emit'
My signal is defined OUTSIDE of init so I don't understand why I have that error?Do I have to add anything else to obtain the Slots/Signal benefits?
-
Woops, I found the reason by myself...
@class myClass(anotherLib.originalClass, QtCore.QObject):
def init(self,username,password):
QtCore.QObject.init(self)@Adding the QObject parent class and calling it during the init