当前位置:网站首页>QApplication a (argc, argv) and exec() in the main function of QT getting started
QApplication a (argc, argv) and exec() in the main function of QT getting started
2022-06-12 00:37:00 【Briquette jingling】
One of the simplest 、 The rudimentary QT The procedure is as follows
int main(int argc,char * argv[])
{
QApplication a(argc,argv);
MainWindow w;
w.show();
return a.exec();
}
(1)QApplication a(argc,argv);
Define a Qt Application object , Its constructor receives and main Function like parameters , yes Qt Graphical interface program entry , It's like main Function is normal C++ The entrance of the program is the same .
(2)return a.exec();
Will enter Qt Application's The event loop function Wait for messages from the user's operation and system And then deal with it .
common c/c++ Language main Functions are all direct return 0 Of , Program exit . But graphic programs usually need to be connected with User interaction , Will not automatically turn off , Instead, it waits for the user to operate . If the user clicks the close button of the window , The program will end and return a value , The default is 0 .
qt in main The function starts with an initialization , Then give control to qt, Then all the events will be handled only qt The event loop of handles .
边栏推荐
- Argodb 3.2 of star ring technology was officially released to comprehensively upgrade ease of use, performance and security
- How to measure the app project? How to build a test system
- Pass the command parameters for operating mongodb to Mongo in the shell
- Tencent programmer roast: 1kW real estate +1kw stock +300w cash, ready to retire at the age of 35
- 使用 select 切换协程
- 月份选择器禁用当月以后的数据 包含当月
- Experiment 6 constructor + copy construction
- 设计消息队列存储消息数据的 MySQL 表格
- App startup process: from clicking the application icon to the activity startup process
- Investment analysis and demand forecast report of global and Chinese fluorosilicone industry in 2022
猜你喜欢

DPT-FSNET: DUAL-PATH TRANSFORMER BASED FULL-BAND AND SUB-BAND FUSION NETWORK FOR SPEECH ENHANCEMENT

SF14 | supertrend "super trend" indicator magic change and upgrade (source code)

How to package and send compressed files for mobile WPS

Pycharm file name taboo

What is bonded warehouse and what is the difference between them

Unified certification center oauth2 high availability pit

How does Kingview use the wireless host link communication module to remotely collect PLC data?
![[case] building a universal data lake for Fuguo fund based on star ring technology data cloud platform TDC](/img/e0/0326d01fc78ed2f96a475e28e74d1c.jpg)
[case] building a universal data lake for Fuguo fund based on star ring technology data cloud platform TDC

汛期化工和危险品企业如何加强防控重大安全风险

Devops landing practice drip and pit stepping records - (1)
随机推荐
JS -- prevent automatic recovery of page position
Optimization method of win7 FPS
Started with trust and loyal to profession | datapipeline received a thank you letter from Shandong city commercial bank Alliance
Construction environnementale 2
App startup process: from clicking the application icon to the activity startup process
Wechat applet Chinese English conversion
关于 MySQL 修改密码失败
APP项目怎么测?如何搭建测试体系
How to measure the app project? How to build a test system
Enterprise wechat H5_ Integrated message decryption class, message push get and post callback processing
The time selector style is disordered and the middle text is blocked
Flutter 使用本地图片
Use select to switch coroutines
repeat_ L2-009 red envelope grabbing_ sort
How much does it cost to develop s2b2c mall system
Invalid spacing setting before WPS Title segment solution
NFS quotas:Cannot register service: RPC: Authentication error
Devops landing practice drip and pit stepping records - (1)
Explore table component virtualization
[JUC series] overview of executor framework