def connect(sender, signal, callback):
"""Connect a signal.
Use this function only in cases where code should work with both Qt5 and Qt4, as it is an ugly hack.
Args:
sender: The Qt object emitting the signal
signal: A string, containing the signal signature (as in Qt4 and PySide)
callback: The function to be called upon receiving the signal
"""
if use_qt5:
return getattr(sender, signal.split('(', 1)[0]).connect(callback)
else:
return sender.connect(QtCore.SIGNAL(signal), callback)
评论列表
文章目录