[Qt-interest] How do QApplication relates to QWidget
wei
willgun.x at gmail.com
Wed Jul 28 09:27:27 CEST 2010
Hi, all!
I am wondering how QApplication relates to QWidget in a qt application
such as the following one:
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QMainWindow win;
QPushButton* button = new QPushButton("exit", &win);
button->setText("Exit");
QObject::connect(button, SIGNAL(clicked()), &win, SLOT(close()));
win.show();
button->show();
return app.exec();
}
The QMainWindow object "win" is created after "app", and there's no
parameter related to "app" in its constructor.
So how can "app" know it has a widget named "win"? If "app" don't know
the fact, how can it process and dispatch messages related to win?
Thanks!
More information about the Qt-interest-old
mailing list