views:

464

answers:

1

Hello, i have a question. There is application class in my program. It is inherited from QtGui.QMainWindow. In ini I call my own method which works with graphic. And it should be called before resize event. How can i do that? Thanks.

EDIT: As you can se here the value of resize event is 14, and show event is 17. So i should find event with less than 14 value.

I found my problem. In constructor before creating handle of image i'm moving window to some position... So during that action resizeEvent calls. Sorry for this question.

A: 

You could override in your class the resizeEvent method (which QMainWindows inherits from QWidget), see http://doc.trolltech.com/4.4/qwidget.html#resizeEvent -- in your override, call your other code, then delegate the rest of the work to the parent's version of the method.

Alex Martelli
I've already done it. In a few words: in resize event i draw window-background, but object which has handler for the picture is called in __init__. So, when resize event calls, there isn't handler for image, but second calling of that event is ok.
Ockonal
Alex, it's probably better to link to the latest version of Qt's API. PyQt is currently working with 4.4
Eli Bendersky
yep, good point -- editing my response to fix this, tx.
Alex Martelli