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


边栏推荐
- LeetCode 练习——剑指 Offer 36. 二叉搜索树与双向链表
- 10. CNN applied to handwritten digit recognition
- 2022 safety officer-b certificate examination question bank and safety officer-b certificate simulation test questions
- Basic realization of line graph
- Matlab code on error analysis (MAE, MAPE, RMSE)
- NPM Internal Split module
- 2022 R1 fast opening pressure vessel operation test question bank and R1 fast opening pressure vessel operation free test questions
- 4、策略学习
- Parade ps8625 | replace ps8625 | EDP to LVDS screen adapter or screen drive board
- Understanding of maximum likelihood estimation
猜你喜欢

Chapter VIII integrated learning

Macro definition and multiple parameters

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

5. Discrete control and continuous control

Markdown learning (entry level)

Running OFDM in gnuradio_ RX error: gr:: Log: info: packet_ headerparser_ b0 - Detected an invalid packet at item ××

2021-03-14 - play with generics

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

Complete model verification (test, demo) routine

Transportation, new infrastructure and smart highway
随机推荐
Recommend a document management tool mendely Reference Manager
2021 tea master (primary) examination materials and tea master (primary) simulation test questions
Definition and classification of energy
Generic configuration legend
USB type-C docking design | design USB type-C docking scheme | USB type-C docking circuit reference
How to get the first and last days of a given month
The solution of frame dropping problem in gnuradio OFDM operation
Kindle operation: transfer downloaded books and change book cover
6. Dropout application
Vs code configuration latex environment nanny level configuration tutorial (dual system)
4. Strategic Learning
2022 high altitude installation, maintenance and demolition examination materials and high altitude installation, maintenance and demolition operation certificate examination
Chapter IV decision tree
Introduction to the types and repair methods of chip Eco
Continued from the previous design
The combination of relay and led small night light realizes the control of small night light cycle on and off
2021-03-06 - play with the application of reflection in the framework
5. Contrôle discret et contrôle continu
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
A speed Limited large file transmission tool for every major network disk
