实现HelloWorld有2种方法。

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

QT学习之-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();
}

  QT学习之-HelloWorld

 

 

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

QT学习之-HelloWorld

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

相关文章:

  • 2022-01-22
  • 2021-11-07
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
猜你喜欢
  • 2021-11-26
  • 2021-11-16
  • 2021-04-09
  • 2021-12-15
  • 2021-08-07
  • 2022-12-23
相关资源
相似解决方案