I want to emit unknown number of argument to a pyqtSignal
E.g. when passing unknown args to a def:-
def oPrint(*args):
print(args)
I want to do the same with pyqtSignal. Ie:-
class UI(QMainWindow):
msgSig = pyqtSignal(*object) #this gives error
TL; DR; Qt needs to know the number of arguments so your requirement cannot be fulfilled.
A workaround is to use some container as a list or tuple.
class UI(QMainWindow):
msgSig = pyqtSignal(list)
ui = Ui()
l = [1, "2", 3, "4"]
ui.msgSig.emit(l)
def oPrint(args):
print(args)