当前位置:网站首页>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 进入帮助文档


边栏推荐
- common commands
- Ag9310 for type-C docking station scheme circuit design method | ag9310 for type-C audio and video converter scheme circuit design reference
- Running OFDM in gnuradio_ RX error: gr:: Log: info: packet_ headerparser_ b0 - Detected an invalid packet at item ××
- 5、離散控制與連續控制
- Redis cluster
- Common fault analysis and Countermeasures of using MySQL in go language
- 8. Optimizer
- Chapter improvement of clock -- multi-purpose signal modulation generation system based on ambient optical signal detection and custom signal rules
- 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
- USB type-C mobile phone projection scheme | USB type-C docking station scheme | TV / projector type-C converter scheme | ag9300ag9310ag9320
猜你喜欢

Complete model training routine

2021-03-14 - play with generics

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

Smart grid overview

10. CNN applied to handwritten digit recognition

Getting started STM32 -- how to learn stm32

The communication clock (electronic time-frequency or electronic time-frequency auxiliary device) writes something casually

Led serial communication

Common configurations in rectangular coordinate system

For the first time in China, three Tsinghua Yaoban undergraduates won the stoc best student thesis award
随机推荐
3、多智能体强化学习
2022 safety officer-c certificate examination summary and safety officer-c certificate reexamination examination
USB type-C docking design | design USB type-C docking scheme | USB type-C docking circuit reference
Using GPU to train network model
Frrouting BGP protocol learning
About how USRP sets the sampling frequency below the minimum sampling frequency reached by the hardware
2022 safety officer-c certificate examination paper and safety officer-c certificate simulated examination question bank
The examination contents of the third batch of Guangdong Provincial Safety Officer a certificate (main person in charge) in 2021 and the free examination questions of the third batch of Guangdong Prov
Vscode reading Notepad Chinese display garbled code
EDP to LVDS conversion design circuit | EDP to LVDS adapter board circuit | capstone/cs5211 chip circuit schematic reference
2022 free test questions of fusion welding and thermal cutting and summary of fusion welding and thermal cutting examination
Matlab code on error analysis (MAE, MAPE, RMSE)
Cs5261type-c to HDMI alternative ag9310 | ag9310 alternative
4. Strategic Learning
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
Recommend a document management tool mendely Reference Manager
2022 safety officer-b certificate examination question bank and safety officer-b certificate simulation test questions
Chapter improvement of clock -- multi-purpose signal modulation generation system based on ambient optical signal detection and custom signal rules
The communication clock (electronic time-frequency or electronic time-frequency auxiliary device) writes something casually
1. Linear regression
