[PyQt] converting old signal/slot to new signal/slot
Florian Bruhin
me at the-compiler.org
Thu May 28 13:15:12 BST 2015
> It looks as if you are trying to have your signal not just exist but pass a
> parameter? The syntax for that in pyQtSignal is a bit obscure and I'm not
> comfortable with it so maybe somebody else can write about that.
It's quite simple, IMHO (at least as you don't need overloaded
signals):
class myWidget( QWidget ):
databaseChanged = pyqtSignal(str)
[...]
# self.react_to_db is a callable taking one argument.
self.databaseChanged.connect( self.react_to_db )
[...]
if database_has_changed :
# database_name has to be a string
self.databaseChanged.emit(database_name)
(also, note that it's pyqtSignal, not pyQtSignal)
Florian
--
http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
I love long mails! | http://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150528/40b80f92/attachment-0001.sig>
More information about the PyQt
mailing list