当前位置:网站首页>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 进入帮助文档
边栏推荐
- Gnuradio operation error: error thread [thread per block [12]: < block OFDM_ cyclic_ prefixer(8)>]: Buffer too small
- Chapter VIII integrated learning
- 5. Contrôle discret et contrôle continu
- 7. Regularization application
- Solve the error: NPM warn config global ` --global`, `--local` are deprecated Use `--location=global` instead.
- About how USRP sets the sampling frequency below the minimum sampling frequency reached by the hardware
- Talk about smart Park
- Transportation, new infrastructure and smart highway
- Four digit nixie tube display multi digit timing
- FIR filter of IQ signal after AD phase discrimination
猜你喜欢
Ag9311maq design 100W USB type C docking station data | ag9311maq is used for 100W USB type C to HDMI with PD fast charging +u3+sd/cf docking station scheme description
Chapter VIII integrated learning
Complete model training routine
Ag9310 for type-C docking station scheme circuit design method | ag9310 for type-C audio and video converter scheme circuit design reference
11. Recurrent neural network RNN
Scalar / vector / matrix derivation method
The communication clock (electronic time-frequency or electronic time-frequency auxiliary device) writes something casually
How to write mark down on vscode
Capstone/cs5210 chip | cs5210 design scheme | cs5210 design data
Ag9310meq ag9310mfq angle two USB type C to HDMI audio and video data conversion function chips parameter difference and design circuit reference
随机推荐
14. Draw network model structure
Several frequently used OCR document scanning tools | no watermark | avoid IQ tax
Call (import) in Jupiter notebook ipynb . Py file
C# ?,?.,?? .....
5. Contrôle discret et contrôle continu
1. Linear regression
Redis集群
Vscode is added to the right-click function menu
5、离散控制与连续控制
Understanding of prior probability, posterior probability and Bayesian formula
2021-03-06 - play with the application of reflection in the framework
Capstone/cs5210 chip | cs5210 design scheme | cs5210 design data
Macro definition and multiple parameters
4. Strategic Learning
2022 chemical automation control instrument examination summary and chemical automation control instrument simulation examination questions
ROS 问题(topic types do not match、topic datatype/md5sum not match、msg xxx have changed. rerun cmake)
General configuration toolbox
Guojingxin center "APEC investment +": some things about the Internet sector today | observation on stabilizing strategic industrial funds
break algorithm---刷题map
Common fault analysis and Countermeasures of using MySQL in go language