美文网首页
Qt 教程一 —— 第一章: Hello, World!

Qt 教程一 —— 第一章: Hello, World!

作者: 葬歌倾城 | 来源:发表于2019-01-10 13:29 被阅读36次

窗口显示:Hello, World!   ;

基于qt5;

//main.c

#include "mainwindow.h"

#include <QApplication>

#include <QPushButton>    //按钮类的调用声明;

int main(int argc, char *argv[])

{

    //创建并处理命令行变量;

    QApplication a(argc, argv);

    //定义一个hello按钮名称为"hello,world!"0为父窗口;

    QPushButton hello( "Hello world!", 0 );

    //定义hello窗口初始尺寸;

    hello.resize( 100, 30 );

    //显示hello窗口;

    hello.show();

    //main函数把控制交给qt;当程序退出时,exec()返回;

    return a.exec();

}

运行效果

有任何问题请留言,感谢支持;

相关文章

网友评论

      本文标题:Qt 教程一 —— 第一章: Hello, World!

      本文链接:https://www.haomeiwen.com/subject/nffarqtx.html