What did QWidget* QApplication::mainWidget() become in Qt4?

c++, qt4

Solution

Technically, any widget initialized with NULL is a top level widget so QApplication shouldn't assume that one of them is better than another. The way I usually do it is to save a pointer to the "real" main widget somewhere, even a global variable or a singleton and reference it when needed.

Problem

I am porting an application from Qt3 to Qt4, and need a Qt4 replacement for QApplication::mainWidget() which used to return the top-level widget in Qt3. Does anyone know how to do this in Qt4?

Original source