当前位置:网站首页>QT -- create QT program
QT -- create QT program
2022-07-08 01:57:00 【bin elf】
New folder -- Chinese path is not required
open qt
Example : It's a self-contained example
Start to practice -- Create a new one qt
Click on choose
You can choose multiple or single -- next step
Base class :QMainwindow stay pc End windows window , With menu bar
Qdialog: Dialog box
qwidget: The most commonly used base class
Change to : amount to Class name is a subclass Base class : Parent class
That is : class myWidget:public QWidget
Click next complete
Realization effect :
Three ways to run
Shortcut key ctrl+r
function : Realization effect
How to look at the code
A program from main The function starts to see :
#include "mywidget.h"
#include <QApplication>
//QApplication Application class
//Qt The header file doesn't have .h
// The header file is the same as the class name
// The header file is capitalized with the first two letters
int main(int argc, char *argv[])
{
// Objects with and only one application class --- Even if there are many windows
QApplication a(argc, argv);
//myWidget Inherited from QWidget,QWidget Is a window base class
// therefore myWidget It is also a window class
//w It's just a window Instance object
myWidget w;
// Window creation is hidden by default , It needs to be displayed manually
w.show();
// These two sentences are equivalent to the following sentence
//a.exec(); a Is the application window created earlier Keep the program running , Waiting for user operation , Cycle all the time
// And wait for the event to happen ( Mouse events The occurrence of keyboard events )
//return 0;
return a.exec();
}
Constructors Destructor
Go to the project file to check :
stay explorer It shows that
after
The meaning of the module : Go to .h In file , Place the cursor in the base class Press F1 Enter the help document
边栏推荐
- Apache多个组件漏洞公开(CVE-2022-32533/CVE-2022-33980/CVE-2021-37839)
- Tapdata 的 2.0 版 ,开源的 Live Data Platform 现已发布
- 电路如图,R1=2kΩ,R2=2kΩ,R3=4kΩ,Rf=4kΩ。求输出与输入关系表达式。
- cv2-drawline
- Codeforces Round #633 (Div. 2) B. Sorted Adjacent Differences
- PHP 计算个人所得税
- 给刚入门或者准备转行网络工程师的朋友一些建议
- The foreach map in JS cannot jump out of the loop problem and whether foreach will modify the original array
- Neural network and deep learning-5-perceptron-pytorch
- 由排行榜实时更新想到的数状数值
猜你喜欢
Voice of users | understanding of gbase 8A database learning
神经网络与深度学习-5- 感知机-PyTorch
PB9.0 insert OLE control error repair tool
Neural network and deep learning-5-perceptron-pytorch
Beaucoup d'enfants ne savent pas grand - chose sur le principe sous - jacent du cadre orm, non, ice River vous emmène 10 minutes à la main "un cadre orm minimaliste" (collectionnez - le maintenant)
Remote Sensing投稿經驗分享
C language -cmake cmakelists Txt tutorial
Sum of submatrix
Apache multiple component vulnerability disclosure (cve-2022-32533/cve-2022-33980/cve-2021-37839)
From starfish OS' continued deflationary consumption of SFO, the value of SFO in the long run
随机推荐
Apache multiple component vulnerability disclosure (cve-2022-32533/cve-2022-33980/cve-2021-37839)
The foreach map in JS cannot jump out of the loop problem and whether foreach will modify the original array
MySQL查询为什么没走索引?这篇文章带你全面解析
鼠标事件-事件对象
Can you write the software test questions?
Mouse event - event object
生态 | 湖仓一体的优选:GBase 8a MPP + XEOS
快手小程序担保支付php源码封装
C language - modularization -clion (static library, dynamic library) use
微软 AD 超基础入门
Nacos microservice gateway component +swagger2 interface generation
How to make the conductive slip ring signal better
I don't know. The real interest rate of Huabai installment is so high
MySQL查询为什么没走索引?这篇文章带你全面解析
Tapdata 的 2.0 版 ,开源的 Live Data Platform 现已发布
Redux使用
How to realize batch control? MES system gives you the answer
Cross modal semantic association alignment retrieval - image text matching
Application of slip ring in direct drive motor rotor
剑指 Offer II 041. 滑动窗口的平均值