当前位置:网站首页>【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("嗨嗨害");边栏推荐
- Implementation of online shopping mall system based on SSM
- Cs5268 perfectly replaces ag9321mcq typec multi in one docking station solution
- After 65 days of closure and control of the epidemic, my home office experience sharing | community essay solicitation
- After eight years of test experience and interview with 28K company, hematemesis sorted out high-frequency interview questions and answers
- 有时候只查询一行语句,执行也慢
- Why do I have a passion for process?
- pytorch 模型保存的完整例子+pytorch 模型保存只保存可训练参数吗?是(+解决方案)
- Kt148a voice chip IC user end self replacement voice method, upper computer
- Common problems and description of kt148a voice chip IC development
- 【Hot100】22. 括号生成
猜你喜欢

勵志!大凉山小夥全獎直博!論文致謝看哭網友

Attack and defense world PWN question: Echo

八年测开经验,面试28K公司后,吐血整理出高频面试题和答案

API documentation tool knife4j usage details

面试经验总结,为你的offer保驾护航,满满的知识点

Motivation! Big Liangshan boy a remporté le prix Zhibo! Un article de remerciement pour les internautes qui pleurent

RPD product: super power squad nanny strategy

MySQL function

台湾SSS鑫创SSS1700替代Cmedia CM6533 24bit 96KHZ USB音频编解码芯片

疫情封控65天,我的居家办公心得分享 | 社区征文
随机推荐
《MongoDB入门教程》第03篇 MongoDB基本概念
Why do I have a passion for process?
Zabbix5 client installation and configuration
良心总结!Jupyter Notebook 从小白到高手,保姆教程来了!
At compilation environment setup -win
【Hot100】22. bracket-generating
有时候只查询一行语句,执行也慢
GCC: Graph Contrastive Coding for Graph Neural NetworkPre-Training
Refactoring: improving the design of existing code (Part 2)
【Hot100】21. 合并两个有序链表
[译]深入了解现代web浏览器(一)
Set up sentinel mode. Reids and redis leave the sentinel cluster from the node
【每日一题】241. 为运算表达式设计优先级
What is the Bluetooth chip ble, how to select it, and what is the path of subsequent technology development
八年测开经验,面试28K公司后,吐血整理出高频面试题和答案
Postman download and installation
【Hot100】23. Merge K ascending linked lists
CS5268完美代替AG9321MCQ Typec多合一扩展坞方案
Introduction to program ape (XII) -- data storage
Taiwan SSS Xinchuang sss1700 replaces cmmedia cm6533 24bit 96KHz USB audio codec chip