- 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
2008年11月18日星期二
C++ STL1
用起瘾了,不好不好,忽略了具体实现和基本功,所谓理由是更能把精力放在算法上。。
不多总结,具体使用方法参见 http://www.cplusplus.com/reference/
今天收获是关键字排序,参见 一个多关键字排序例子
其中ICmpMuls也可直接放MultiData中,bool operator() 重载圆括号,sort第三个参数具体机理还很茫然(updated: 函数指针),以后如果将C++作为主语言,熟练后一定要读读STL源码剖析那本书。
不多总结,具体使用方法参见 http://www.cplusplus.com/reference/
今天收获是关键字排序,参见 一个多关键字排序例子
其中ICmpMuls也可直接放MultiData中,bool operator() 重载圆括号,sort第三个参数具体机理还很茫然(updated: 函数指针),以后如果将C++作为主语言,熟练后一定要读读STL源码剖析那本书。
2008年11月8日星期六
qt1
1.
通过使用一个layout管理器对旋转窗口和滑块窗口进行了布局设置。一个布局管理者就是一个根据窗口作用设置其大小和位置的对象。Qt有三个主要的布局管理类:
QHBoxLayout:将窗口部件水平自左至右设置(有些情况下是自右向左)。
QVBoxLayout:将窗口部件垂直自上向下设置。
QGridLayout: 以网格形式设置窗口部件。
调用QWidget::setLayout()函数在对象window上安装布局管理器。通过这个调用,部件自动成为布局管理器所在窗口的子窗口。
2.
Qt程序员最常用的设计模式是:说明所需要的窗口部件,然后设置这些部件必须的特性。程序员把窗口部件添加到布局管理器中,布局管理器就将自动地设置这些部件的大小和位置。而用户界面的行为是通过连接各个部件(运用信号SIGNAL/槽SLOT机制)来实现的。
2008年10月31日星期五
2008年10月26日星期日
订阅:
博文 (Atom)