当前位置:网站首页>【QT】QPushButton创建
【QT】QPushButton创建
2022-07-02 19:08:00 【绅士·永】
目录
一、函数解释
1、创建按钮
头文件:#include <QPushButton>
QPushButton * btn = new QPushButton;
btn->show();// 以顶出的方式弹出窗口
二、代码运用及运行结果
//创建一个按钮
QPushButton * btn = new QPushButton;
btn->show();// 以顶出的方式弹出窗口
//让btn依赖在widget窗口中
btn->setParent(this);
//显示文本
btn->setText("第一个按钮");
//创建第二个按钮 按照控件的大小来创建窗口
QPushButton * btn2 = new QPushButton("第二个按钮", this);
//移动btn2
btn2->move(100,100);
//设置btn2的大小
btn2->resize(50,50);
//重置窗口的大小
resize(600,400);
//设置固定的窗口大小
setFixedSize(600,400);
//设置窗口的标题
setWindowTitle("嗨嗨害");
边栏推荐
- Yes, that's it!
- Solution: vs2017 cannot open the source file stdio h main. H header document [easy to understand]
- 【NLP】一文详解生成式文本摘要经典论文Pointer-Generator
- Correspondence between pytoch version, CUDA version and graphics card driver version
- [JS] get the search parameters of URL in hash mode
- KT148A语音芯片ic的开发常见问题以及描述
- sql-labs
- PXE installation "recommended collection"
- upload-labs
- JS如何取整数
猜你喜欢
Overview of browser caching mechanism
pytorch 模型保存的完整例子+pytorch 模型保存只保存可训练参数吗?是(+解决方案)
[internship] solve the problem of too long request parameters
How can testers do without missing tests? Seven o'clock is enough
Refactoring: improving the design of existing code (Part 2)
KS004 基于SSH通讯录系统设计与实现
Taiwan SSS Xinchuang sss1700 replaces cmmedia cm6533 24bit 96KHz USB audio codec chip
Kt148a voice chip IC user end self replacement voice method, upper computer
Educational codeforces round 129 (rated for Div. 2) supplementary problem solution
勵志!大凉山小夥全獎直博!論文致謝看哭網友
随机推荐
多端小程序开发有什么好处?覆盖百度小程序抖音小程序微信小程序开发,抢占多平台流量红利
[NLP] a detailed generative text Abstract classic paper pointer generator
c语言里怎么设立优先级,细说C语言优先级
CS5268完美代替AG9321MCQ Typec多合一扩展坞方案
励志!大凉山小伙全奖直博!论文致谢看哭网友
Implementation of online shopping mall system based on SSM
蓝牙芯片ble是什么,以及该如何选型,后续技术发展的路径是什么
攻防世界pwn题:Recho
KT148A语音芯片ic的用户端自己更换语音的方法,上位机
【Hot100】23. Merge K ascending linked lists
[ERP software] what are the dangers of the secondary development of ERP system?
Automatically generate VGg image annotation file
疫情封控65天,我的居家办公心得分享 | 社区征文
How to do interface testing? After reading this article, it will be clear
Sometimes only one line of statements are queried, and the execution is slow
Correspondence between pytoch version, CUDA version and graphics card driver version
Design and implementation of ks004 based on SSH address book system
Educational codeforces round 129 (rated for Div. 2) supplementary problem solution
Zabbix5 client installation and configuration
Introduction to program ape (XII) -- data storage