PyQt Tips and Tricks: Difference between revisions
From Maemo Wiki
Jump to navigationJump to search
imported>epage No edit summary |
imported>epage |
||
| Line 2: | Line 2: | ||
= Tips and Tricks = | = Tips and Tricks = | ||
== Identifying the Sender of a Signal == | |||
There are two main approaches for this. The first is to wrap the slot with a lambda to pass in any additional arguments | |||
def notifyMe(foo) | |||
print foo | |||
x = lambda: notifyMe("they call him tim") | |||
self.connect(b, SIGNAL("clicked()"), d.close) | |||
self.connect(f, SIGNAL("clicked()"), x) | |||
The second and more general solution is to use the [http://pysnippet.blogspot.com/2010/06/qsignalmapper-at-your-service.html QSignalMapper] | |||
= Example Applications = | = Example Applications = | ||
Revision as of 14:36, 16 June 2010
With Meego there is a lot of interest in developing applications in Qt rather than GTK. This page spawned from a discussion thread.
Tips and Tricks
Identifying the Sender of a Signal
There are two main approaches for this. The first is to wrap the slot with a lambda to pass in any additional arguments
def notifyMe(foo)
print foo
x = lambda: notifyMe("they call him tim")
self.connect(b, SIGNAL("clicked()"), d.close)
self.connect(f, SIGNAL("clicked()"), x)
The second and more general solution is to use the QSignalMapper