[PyKDE] QWidgetFactory problems

Eli Yukelzon reflog at gmail.com
Sun Feb 6 15:59:26 GMT 2005


Thanks for your reply.
I've tried to overcome the fact that closeEvent is not copied.
I tried just overwriting the attr, that didn't work. Then i tried
using 'instancemethod' to apply
the new closeEvent to ui class. No luck.

Maybe i'm missing something?

thanks in advance,

eli yukelzon


On Sun, 06 Feb 2005 16:26:34 +0100, Torsten Marek <shlomme at gmx.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Eli Yukelzon schrieb:
> | Hi there.
> |
> | I've picked up a very nice WidgetFactory wrapper from PyQT wiki, and
> | been a very happy user so far. But today I've came across a very
> | serious (for me) problem with it, and was hoping that someone can shed
> | some light over this. Here's the situation:
> | I have QMainWindow and I want to catch it's closeEvent (to ask for
> | user interaction). When I use pyuic to generate the class, and then
> | capture the event - all works just great.
> | When I use WidgetFactory to create the window, the event is fired only
> | when the signal is emited (i,e when i connect some button to close()
> | slot), but not when the event is 'spontanious', i.e. when the 'x'
> | button is pressed in window's titlebar.
> |
> | I've attached an example of the problem. the ui file, the qt_loader
> | which is the WidgetFactory wrapper, and .py file which has both
> | versions of code, with, and without WidgetFactory.
> |
> | Thanks in advance,
> |
> | Eli Yukelzon
> |
> 
> Hello Eli,
> 
> I think I spotted the problem, I hope my explanation is sufficient.
> 
> - - create is called with connector instance
> - - ui instance (ui) is loaded
> - - attributes are copied over from ui to Connection (but only, if they do not
> exist in Connector)
> - - for every connection in ui, Qt.connect is setup that in a way so that methods
> in Connector (!) are called
> 
> Now, if the button is clicked in ui, it calls Connector.close, which itself
> calls Connector.closeEvent, which prints out its message.
> If the window close button is clicked, ui.close is called, which calls
> ui.closeEvent (<- not overridden!).
> To solve this problem (in a hackish manner), you would also have to copy over
> the overridden event handlers from Connector to ui. Anyway, I'm not convinced
> that this is good style. There should be a better solution for run-time
> generated UI files, but it involves a more sophisticated approach.
> 
> Anybody in for good ideas, so I don't have to think too much?
> 
> greetings
> 
> Torsten
> - --
> Torsten Marek <shlomme at gmx.net>
> ID: A244C858 -- FP: 1902 0002 5DFC 856B F146  894C 7CC5 451E A244 C858
> Keyserver: subkeys.pgp.net
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.0 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
> 
> iD8DBQFCBjcqfMVFHqJEyFgRAuIRAKC0YRARL5l34llQEZAODiIz2l/O3QCgqAXC
> eXrD3WB+utwsYBWXXmdtrdo=
> =L722
> -----END PGP SIGNATURE-----
> 
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
> 


-- 
2B OR NOT 2B = FF




More information about the PyQt mailing list