QT学习之-HelloWorld

实现HelloWorld有2种方法。

第一种在mainwindow.ui直接添加Label且写上“HelloWorld”。

 

第二种是代码直接实现

#include "mainwindow.h"
#include <QApplication>
#include <QtWidgets/QLabel>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QLabel label("HelloWorld \n");
    label.show();
//    MainWindow w;
//    w.show();

    return a.exec();
}

  

 

 

如果要直接运行.exe可执行程序的话 要把C:\Qt\Qt5.5.0\5.5\mingw492_32\bin添加到环境变量

 添加环境变量的步骤,计算机属性->高级设置->环境变量->添加Path=C:\Qt\Qt5.5.0\5.5\mingw492_32\bin

posted @ 2016-07-14 21:44  SuGuolin  阅读(295)  评论(0编辑  收藏  举报