I have a strange problem. Here is my code:
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)
So I get this in console:
A: 0 <type 'int'>
B: <type 'int'> <type 'type'>
In "B" you should get the same than in "A". Anyone knows what's wrong? How can I get the arg1 value instead of its type? This is not making any sense...
PS: I'm trying something like this: http://lists.trolltech.com/qt-interest/2004-08/thread00659-0.html
The parameter passed to the
SLOT
function must be a string with types as parameters, not a direct call, so you can't connect a slot with parameters to a signal without any parameter.You can use a lambda function instead:
It looks like when you are calling this:
are you meaning to call this instead?
you are passing
int
as the first argument ofrecall
, which passes it directly tomethod1
.int
is a type object (the type of integers).