当前位置:网站首页>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 进入帮助文档
边栏推荐
- The beauty of Mathematics -- the principle of fine Fourier transform
- 解决报错:npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
- Frrouting BGP protocol learning
- Multi purpose signal modulation generation system based on environmental optical signal detection and user-defined signal rules
- Guojingxin center "friendship and righteousness" - the meta universe based on friendship and friendship, and the parallel of "honguniverse"
- Using GPU to train network model
- 2022 safety officer-c certificate examination paper and safety officer-c certificate simulated examination question bank
- Chapter 5 neural network
- Vs code configuration latex environment nanny level configuration tutorial (dual system)
- Macro definition and multiple parameters
猜你喜欢
Taiwan Xinchuang sss1700 latest Chinese specification | sss1700 latest Chinese specification | sss1700datasheet Chinese explanation
Guojingxin center "APEC education +" Shanghai Jiaotong University Japan Cooperation Center x Fudan philosophy class "Zhe Yi" 2022 New Year greetings
Basic realization of line chart (II)
2022 low voltage electrician examination content and low voltage electrician simulation examination question bank
The combination of relay and led small night light realizes the control of small night light cycle on and off
Common configurations in rectangular coordinate system
3、多智能体强化学习
Talk about smart Park
2021 Shanghai safety officer C certificate examination registration and analysis of Shanghai safety officer C certificate search
Definition and classification of energy
随机推荐
Ag9310 design USB type C to hdmi+u2+5v slow charging scheme design | ag9310 expansion dock scheme circuit | type-C dongle design data
2022 low voltage electrician examination content and low voltage electrician simulation examination question bank
Kuntai ch7511b scheme design | ch7511b design EDP to LVDS data | pin to pin replaces ch7511b circuit design
6. Dropout application
5、离散控制与连续控制
解决报错:npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
How to use education discounts to open Apple Music members for 5 yuan / month and realize member sharing
Generic configuration legend
Complete model training routine
The combination of relay and led small night light realizes the control of small night light cycle on and off
Chapter IV decision tree
npm 內部拆分模塊
Guojingxin center "APEC investment +": some things about the Internet sector today | observation on stabilizing strategic industrial funds
Chapter 16 intensive learning
2022 refrigeration and air conditioning equipment operation examination questions and refrigeration and air conditioning equipment operation examination skills
Two methods for full screen adaptation of background pictures, background size: cover; Or (background size: 100% 100%;)
5. Contrôle discret et contrôle continu
3. MNIST dataset classification
How to get the first and last days of a given month
2021 welder (primary) examination skills and welder (primary) operation examination question bank