Originally Posted by
wysota
Well... basicly you can call parent() as long as it returns something other than null. The last non-null result returned will be the main window.
Alternatively you can just call qApp->mainWidget() (just remember to #include <qapplication.h> and to set the main widget in main() ).
I tried setting the main widget in main() like so:
#include <QApplication>
#include "mymainwidg.h"
int main(int argc, char** argv)
{
MyMainWidg widg;
app.setMainWidget(&widg);
widg.show();
return app.exec();
}
#include <QApplication>
#include "mymainwidg.h"
int main(int argc, char** argv)
{
QApplication app(argc, argv);
MyMainWidg widg;
app.setMainWidget(&widg);
widg.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
My compiler whines that setMainWidget is undeclared. What have i missed? Was setMainWidget perhaps not available in version 4.2.2?
Bookmarks