Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

qt4

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?

like image 821
Kristian Avatar asked Jul 19 '09 20:07

Kristian


1 Answers

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.

like image 199
shoosh Avatar answered Sep 28 '22 06:09

shoosh