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?
views:
49answers:
1
+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
2009-12-10 08:08:46
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
2009-12-10 17:10:52
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
2009-12-11 09:06:30