当前位置:网站首页>QT--创建QT程序
QT--创建QT程序
2022-07-07 23:28:00 【bin elf】
新建文件夹--不需要中文路径

打开qt 
示例:是自带的例子

开始实操--新建一个qt

点击choose

可以多选和单选--下一步
基类:QMainwindow 在 pc端 windows窗口,带菜单栏
Qdialog:对话框
qwidget:最常用的基类
改成 :相当于 类名是子类 基类:是父类
即是 : class myWidget:public QWidget

点击下一步 完成

实现效果:
运行的三种方式


快捷键 ctrl+r
运行:实现效果

如何看代码
一个程序从main函数开始看:

#include "mywidget.h"
#include <QApplication>
//QApplication应用程序类
//Qt头文件没有.h
//头文件和类名一样
//头文件是前两个字母大写
int main(int argc, char *argv[])
{
//有且只有一个应用程序类的对象---即使有很多个窗口
QApplication a(argc, argv);
//myWidget 继承于QWidget,QWidget是一个窗口基类
//所以myWidget也是一个窗口类
//w就是一个窗口 实例对象
myWidget w;
//窗口创建默认是隐藏的,需要人为显示
w.show();
//这两句话等价于后面那一句
//a.exec(); a是前面创建的应用程序窗口 让程序一直执行,等待用户操作,一直循环
//及等待事件发生(鼠标事件 键盘事件的发生)
//return 0;
return a.exec();
}构造函数 析构函数

去项目文件中查看:

在explorer中显示
之后
模块的含义:去.h文件中,光标放到基类中 按F1 进入帮助文档


边栏推荐
- C# ?,?.,?? .....
- Guojingxin center "APEC education +" Shanghai Jiaotong University Japan Cooperation Center x Fudan philosophy class "Zhe Yi" 2022 New Year greetings
- NPM internal split module
- Connect to the previous chapter of the circuit to improve the material draft
- Vscode reading Notepad Chinese display garbled code
- Application of state mode in JSF source code
- 2022 chemical automation control instrument examination summary and chemical automation control instrument simulation examination questions
- Using GPU to train network model
- NPM Internal Split module
- Kafka-connect将Kafka数据同步到Mysql
猜你喜欢

redis的持久化方式-RDB和AOF 两种持久化机制

Gnuradio transmits video and displays it in real time using VLC

EDP to LVDS conversion design circuit | EDP to LVDS adapter board circuit | capstone/cs5211 chip circuit schematic reference

2022 examination for safety production management personnel of hazardous chemical production units and new version of examination questions for safety production management personnel of hazardous chem

6. Dropout application

4、策略學習

The beauty of Mathematics -- the principle of fine Fourier transform

High quality USB sound card / audio chip sss1700 | sss1700 design 96 kHz 24 bit sampling rate USB headset microphone scheme | sss1700 Chinese design scheme explanation

3. Multi agent reinforcement learning

Content of one frame
随机推荐
Guojingxin center "friendship and righteousness" - the meta universe based on friendship and friendship, and the parallel of "honguniverse"
How to get the first and last days of a given month
2022 safety officer-a certificate free examination questions and safety officer-a certificate mock examination
break algorithm---刷题map
Markdown learning (entry level)
Guojingxin center "APEC education +" Shanghai Jiaotong University Japan Cooperation Center x Fudan philosophy class "Zhe Yi" 2022 New Year greetings
AttributeError: ‘str‘ object has no attribute ‘strftime‘
Continued from the previous design
5、离散控制与连续控制
Redis cluster
Design method and reference circuit of type C to hdmi+ PD + BB + usb3.1 hub (rj45/cf/tf/ sd/ multi port usb3.1 type-A) multifunctional expansion dock
6. Dropout application
Chapter VIII integrated learning
2021 tea master (primary) examination materials and tea master (primary) simulation test questions
Chapter 5 neural network
LaTeX 中 xcolor 颜色的用法
The Ministry of housing and urban rural development officially issued the technical standard for urban information model (CIM) basic platform, which will be implemented from June 1
1. Linear regression
A speed Limited large file transmission tool for every major network disk
2022 new examination questions for crane driver (limited to bridge crane) and question bank for crane driver (limited to bridge crane) operation examination
