我有一個奇怪的問題。這裏是我的代碼:Singleshot:SLOT帶參數
def method1(self, arg1, delay=True):
"""This is a method class"""
def recall(arg1):
self.method1(arg1, delay=False)
return
if delay:
print "A: ", arg1, type(arg1)
QtCore.QTimer.singleShot(1, self, QtCore.SLOT(recall(int)), arg1)
return
print "B: ", arg1, type(arg1)
所以我得到這個控制檯:
A: 0 <type 'int'>
B: <type 'int'> <type 'type'>
在 「B」 你應該得到比 「A」 不變。任何人都知道什麼是錯的?我怎樣才能得到arg1值 ,而不是它的類型?這不作出任何意義......
PS:我想是這樣的:http://lists.trolltech.com/qt-interest/2004-08/thread00659-0.html
感謝您的答覆。你是對的。現在我得到的「B」與「A」相同。但是,我也得到了這個:「Object :: connect:期望的圓括號,插槽RandomClassFromHell ::」。你知道我該如何擺脫它? – Manolo
哦,行是這樣的:QtCore.QTimer.singleShot(1,自我,QtCore.SLOT(召回(ARG1))),因爲它與該aditional的說法XD問題。對不起,這個小編輯框很難寫。 – Manolo
對不起,我對「Qt」或「SLOT」一無所知。您可能需要針對更新後的代碼和問題提出一個新問題。 – TorelTwiddler