What are the differences between creating signals in these two different ways?

天涯浪子 提交于 2019-12-11 19:10:54

问题


Using PySide2, it's possible to create signals in two ways that I know of:

file_changed = Signal()

or

@Signal
def file_changed(self):
    pass

They both seem to do the same thing. What if I want a signal that can emit a value? I know I can do:

file_changed = Signal(str)

...

def load_file(self, file_name):
   self.file_changed.emit(file_name)

But what is the equivalent using the @Signal decorator?

来源:https://stackoverflow.com/questions/57204514/what-are-the-differences-between-creating-signals-in-these-two-different-ways

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!