- The QApplication object must be created before any GUI-related features of Qt are used.
QPushButton hello("Hello world!");A push button is created. Because we don't specify a parent window (as second argument to the QPushButton constructor), the button will be a window of its own, with its own window frame and title bar.- The button's size is determined by its default size hint. We could call QWidget::move() to assign a specific screen position to the widget, but instead we let the windowing system choose a position.
-
hello.show();A widget is never visible when you create it. You must call QWidget::show() to make it visible. return app.exec();
This is where main() passes control to Qtint QApplication::exec ()
Enters the main event loop and waits until exit() is called, then returns the value that was set to exit() (which is 0 if exit() is called via quit()).
2008年11月19日星期三
Reading Qt 4.4 Tutorial 1
订阅:
博文评论 (Atom)
没有评论:
发表评论