Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1760057
  • 博文数量: 290
  • 博客积分: 10653
  • 博客等级: 上将
  • 技术积分: 3178
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-24 23:08
文章存档

2013年(6)

2012年(15)

2011年(25)

2010年(86)

2009年(52)

2008年(66)

2007年(40)

分类: C/C++

2011-01-26 13:53:14

#include
#include 
int main(int argc, char *argv[])
{
    int QExitCode = 0;
    /** 创建一个应用程序对象来管理程序范围内的资源 */
    QApplication app( argc, argv );
    /** info: widget and  MainWindow
        a widget is a visual element in a user interface
        most application use a QMainWindows or a QDialog as the application Window,
        but Qt is so flexible that any Widgets can be a windows .
        Qt's widgets emit signals to indicate that a user action or
        a change of state has occurred .
     */
    QPushButton *button = new QPushButton("Quit");
    button->resize( 100, 30 );
    /** Qt的 widgets 通过发射信号来指出用户的行为或状态发生改变
        一个信号可以和一个函数相连接,称为solt,当single emitted时,
        solt 函数自动执行  */
    QObject::connect(button,SIGNAL(clicked()),&app ,SLOT(quit()));
    /** widgets 被创建后默认为隐藏,因此我们可以在显示它之前对它进行定制,从而避免了闪烁 */
    button->show();
    /**  再这里,程序将控制权传递给QT,进入事件循环,等待用户输入 */
    QExitCode =  app.exec();
    delete button;
    return QExitCode;
}
阅读(1094) | 评论(0) | 转发(0) |
0

上一篇:ftp配置文件

下一篇:linux库文件编写

给主人留下些什么吧!~~