Nov-02-2021, 03:21 PM
1. if the interval of a QTimer is very small that not enough to let the slot function finish before timeout. What will happen? will QTimer wait for the function to finish before starting it again? Or it'll terminate the function and start again?
4. is it ok to pass 'self' around? for example, pass self to the subwindow or pass self to a child thread so that they can control the instantiated root class
timer=QTimer(interval=1) timer.timeout.connect(func) timer.start() def func(): #this function need more than 1 ms2. if a child thread emits a signal to ask the main thread to do a function, will the child thread wait till the function in the main thread is done?
class A(): def main(self): self.b=B() self.b.sig.connect(self.func) self.b.start() def func(self): #some function ### class B(QThread): sig=pyqtSignal() def run(self): self.sig.emit() #will it wait here? Or it'll print the following text immediately? print('A.func() is finished')3. When instantiating a subwindow, do you usually use subwin=Subwin() or self.subwin=Subwin()?
4. is it ok to pass 'self' around? for example, pass self to the subwindow or pass self to a child thread so that they can control the instantiated root class