QT 信号与槽的简单例子

来源:互联网 发布:c语言函数的定义与声明 编辑:程序博客网 时间:2024/05/24 04:59
#include<QtGui>
#include<QApplication>
//#include<QLabel>
//#include<QPushButton>
int main(int argc, char* argv[])
{
    QApplication app(argc, argv);
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GB2312"));
    QPushButton* pPushButton = new QPushButton("点击我退出");
    QObject::connect(pPushButton, SIGNAL(clicked()), &app, SLOT(quit()));
    //在boost当中了解一些,是一种回调
    pPushButton->show();
    return app.exec();
}
编译时可以这样:
qmake -project
qmake Hello.pro
make(unix or Linux) or nmake(windows)
原创粉丝点击