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


边栏推荐
- 2022 tea master (intermediate) examination questions and tea master (intermediate) examination skills
- Talk about smart Park
- Arm bare metal
- Redis cluster
- 1. Linear regression
- 2022 refrigeration and air conditioning equipment operation examination questions and refrigeration and air conditioning equipment operation examination skills
- Ag9310 same function alternative | cs5261 replaces ag9310type-c to HDMI single switch screen alternative | low BOM replaces ag9310 design
- Call (import) in Jupiter notebook ipynb . Py file
- Ag7120 and ag7220 explain the driving scheme of HDMI signal extension amplifier | ag7120 and ag7220 design HDMI signal extension amplifier circuit reference
- For the first time in China, three Tsinghua Yaoban undergraduates won the stoc best student thesis award
猜你喜欢

Chapter 16 intensive learning

STM32GPIO口的工作原理

Complete model training routine

3. Multi agent reinforcement learning

Ag7120 and ag7220 explain the driving scheme of HDMI signal extension amplifier | ag7120 and ag7220 design HDMI signal extension amplifier circuit reference

Guojingxin center "APEC investment +": some things about the Internet sector today | observation on stabilizing strategic industrial funds
![Gnuradio operation error: error thread [thread per block [12]: < block OFDM_ cyclic_ prefixer(8)>]: Buffer too small](/img/ab/066923f1aa1e8dd8dcc572cb60a25d.jpg)
Gnuradio operation error: error thread [thread per block [12]: < block OFDM_ cyclic_ prefixer(8)>]: Buffer too small

Micro rabbit gets a field of API interface JSON

Chapter XI feature selection

Kindle operation: transfer downloaded books and change book cover
随机推荐
Connect to the previous chapter of the circuit to improve the material draft
redis的持久化方式-RDB和AOF 两种持久化机制
Leetcode notes No.7
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
Capstone/cs5210 chip | cs5210 design scheme | cs5210 design data
2022 chemical automation control instrument examination summary and chemical automation control instrument simulation examination questions
Cs5261type-c to HDMI alternative ag9310 | ag9310 alternative
Gnuradio3.9.4 create OOT module instances
2022 tea master (intermediate) examination questions and tea master (intermediate) examination skills
The persistence mode of redis - RDB and AOF persistence mechanisms
Basic realization of line graph
Authorization code of Axure rp9
Overall introduction of the project
break algorithm---刷题map
General configuration title
Guojingxin center "friendship and righteousness" - the meta universe based on friendship and friendship, and the parallel of "honguniverse"
qt-使用自带的应用框架建立--hello world--使用min GW 32bit
Taiwan Xinchuang sss1700 latest Chinese specification | sss1700 latest Chinese specification | sss1700datasheet Chinese explanation
2022 low voltage electrician examination content and low voltage electrician simulation examination question bank
Study notes of single chip microcomputer and embedded system
