[PyKDE] keypressevent + qdatedit
shlomme at gmx.net
Fri Apr 8 00:31:17 BST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Juan Fernando Estrada Henao schrieb:
> this is my solution.
You don't need the setattr (although it's not wrong),
self.lineEdit1.keyPressEvent = self.lineEdit_KeyPress
is fully sufficient.
>>how to i do the implementation keypressevent of a qdateedit make in
>>qtdesigner and converted with pyuic?.
> Hello Juan,
> by outsmarting pyuic.
> 1. Create a Python file and subclass QDateEdit to your needs (let's call the
> file foodate.py and the subimpl FooDateEdit)
> 2. In Designer, open the form settings dialog and write
> Python:from foodate import FooDateEdit as QDateEdit
> 3. Recreate the UI.
BTW, to all: I'm going to put sth. like that into the Python pyuic in a more
sanitized way, so that you can specify that you want all QWhatEver widgets to be
of type YourVerySpecialWhatEver.
> Neither did I test this, nor did I ever do such a thing, but it should work
> IMHO. If it doesn't, just keep complaining!
> The dark side approach would be overwriting the keyPressEvent with another
> method in your widget's __init__ method. To get the taste of it, just look here:
> and adapt the code to your needs.
Torsten Marek <shlomme at gmx.net>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146 894C 7CC5 451E A244 C858
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the PyQt