tags:

views:

49

answers:

1

I have an application in which I would like to connect whatever signal is emitted when a pyqt4 dialog is displayed in order to do execute an initial method. I don't want the method to be called in the __init__ method for a number of reasons. I've spent quite some time searching but I have yet to find an answer. I'm sure there is a simple solution that because of my inexperience I am overlooking as I can do this in wxPython. Suggestions?

+2  A: 

There is no signal emitted on first display, instead, you will have to intercept the first resizeEvent or paintEvent by overloading these methods (as you don't want to initialize from the __init__ method).

Another option would be to add your own showAndInit method, that initializes and then calls show.

e8johan
You could also intercept the showEvent method, which will be called when the dialog is scheduled to be shown (not quite right when it is shown).
Caleb Huitt - cjhuitt
Also, if you do not want to subclass, you can intercept all these events using an event filter, i.e. another class, which then can trigger the initialization.
e8johan