zoukankan      html  css  js  c++  java
  • Qt 编程指南 1 从Hello World开始

    1 简单的hello QT

    注意项目和路径不要包含任何中文字符,特殊字符,空格。

    只能有英文,数字,下划线,且不能数字开头、

      

    //helloqt.cpp
    #include <QtWidgets/QApplication>
    #include <QtWidgets/QLabel>
    
    int main(int argc, char *argv[])
    { 
      //定义一个 Qt 应用程序对象,它的构造函数接收和 main 函数一样的参数,这是 Qt 图形界面程序的入口, 就像 main 函数是 C++ 程序的入口一样
        QApplication a(argc, argv);
    
    //定义了一个 QLabel 标签控件对象,其构造函数里以一个字符串为输入参数,代码里使用了 tr 函数封装了字符串。
    // 只要不是特殊情况,一般都用 tr 函数封装字符串,以后如果做多国语言翻译就会很方便。
        QLabel label( QLabel::tr("Hello Qt!") );
    
    //显示控件窗口
        label.show();
    
    //exec() 函数会进入 Qt 应用程序的事件循环函数等待用户操作
        return a.exec();
    }
    

     

     

  • 相关阅读:
    GPO
    GPO
    GPO
    Active Directory
    Active Directory
    Ethical Hacking
    Tree and Queries CodeForces
    数颜色 HYSBZ
    Powerful array CodeForces
    Group HDU
  • 原文地址:https://www.cnblogs.com/kekeoutlook/p/7467687.html
Copyright © 2011-2022 走看看