[PyKDE] Passing argument in QPopupMenu.insertItem(QString, reveiver)
Maciej Paszta
paszczi at go2.pl
Wed Mar 17 07:18:01 GMT 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday 15 of March 2004 22:53, Maciej Paszta wrote:
> Hi, I have a following problem. I create QPopupMenu and then I insert some
> item. All items should have the same receiver but passing him different
> arguments.
>
> chat = QPopupMenu(self)
> chat.insertItem('Open 1', self.open)
> chat.insertItem('Open 2', self.open)
> chat.insertItem('Open 3', self.open)
>
> def open(self, a0)
> .....
>
> So I want to pass for example 1, 2 or 3 to self.open according to which
> item was selected... Is there any way I can do it, or maybe some workaround
> is needed
OK, I've figured it out !!
id = chat.insertItem('Open 3', self.open)
self.setItemParameter(id, 3)
self.open(self, int)
- --
Maciek "paszczi" Paszta .::. paszczi at go2.pl .::. JID:macp at chrome.pl
gg: 2810043 .::. Linux User #304533 .::. BLUG Member #0247
fingerprint: A484 C4D8 9CC7 2DA3 2F92 E68A 9056 D5CC F22E 4C89
PGP:pgp.mit.edu .::. MPlayerPL Team : mplayerpl.emdej.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFAV+zAkFbVzPIuTIkRApNDAJ9Ewef1VoCCMwhXmg0bq9IRnEb+mQCeOrB/
krXAGZbWOSTfn9sFmpfDk5E=
=cmhh
-----END PGP SIGNATURE-----
More information about the PyQt
mailing list