当前位置:网站首页>QWidget、QPushButton、
QWidget、QPushButton、
2022-08-03 01:58:00 【Lee Neo】
在Ubuntu中查看qt源码:
找到qt安装目录:/opt/Qt/src
搜索 查找qmainwindow.cpp打开源码文件;
QWidget设置背景色步骤:
- 百度rgb对照表:RGB颜色对照表
- 更改样式表代码:
QWidget{background-color:rgb(187,255,255)};
或者:
QWidget{background-color:#BBFFFF};
QPushButton
常用的四个信号:

设置槽函数代码:
void Widget::on_pushButton_clicked()
{
qDebug()<< "click" << endl;
}
void Widget::on_pushButton_pressed()
{
qDebug()<< "pressed" << endl;
}
void Widget::on_pushButton_released()
{
qDebug()<< "released" << endl;
}
---------------------------------------------
pressed
released
click
10:19:18: C:\Users\bruce\Desktop\qt\build-27-Desktop_Qt_5_12_9_MinGW_64_bit-Debug\debug\27.exe exited with code 0音乐播放器按钮项目:
style.qss
QPushButton#pushButton{ border-image: url(:/icons/btn_play_1.png)}
QPushButton#pushButton:hover { border-image: url(:/icons/btn_play_2.png)}
QPushButton#pushButton:checked { border-image: url(:/icons/btn_pause_1.png)}
QPushButton#pushButton:checked:hover { border-image: url(:/icons/btn_pause_2.png)}
widget.cpp
ui->pushButton->setCheckable(true);//设置可选中;实现效果:
鼠标停在按钮上会发光,点击切换播放/暂停;

边栏推荐
- ES6 新特性:Class 的基本语法
- qt opengl 使用不同的颜色绘制线框三角形
- 豆瓣评分9.3的好书,文末给大家抽奖送几本!
- 实现统一账号登录,sonarqube集成ldap
- .NET in-depth analysis of the LINQ framework (four: IQueryable, IQueryProvider interface details)
- 使用VSCode中遇到的问题及解决办法
- 【UE4】Build VR live broadcast in LAN UE4.27
- “蔚来杯“2022牛客暑期多校训练营4 补题题解(N)
- 扩展卡尔曼滤波【转】
- The cornerstone of high concurrency: multithreading, daemon threading, thread safety, thread synchronization, mutual exclusion lock, all in one article!...
猜你喜欢

Wei Dongshan Digital Photo Frame Project Learning (5) Transplantation of libjpeg-turbo

Topic Modeling of Short Texts: A Pseudo-Document View

孩子坐不住就是不专注?猿辅导揭秘专注力的三大误区

Greenplum database failure analysis, can not listen to the port

为什么要使用 playwright 做浏览器自动化测试?

openCV第二篇

一些面试的总结

粘包与拆包

国标GB28181协议EasyGBS平台项目现场通知消息过多导致系统卡顿该如何解决?

Incorrect datetime value: ‘2022-01-01‘ for function str_to_date
随机推荐
Rust Web(三)—— 通过sqlx连接数据库(MySQL)
不想当Window的Dialog不是一个好Modal,弹窗翻身记...
使用VSCode中遇到的问题及解决办法
如何准备考pmp?
12-security退出.md
提高测试覆盖率的四大步骤
可信的SSL证书颁发机构有哪些
vs studio 安装opencv 环境
【面经】被虐了之后,我翻烂了equals源码,总结如下
自定义RunTimeException工具类
8-jwt工具类
9-WebUtil工具类.md
个人开发者必备,免费 API 网关工具推荐
粘包与拆包
.NET in-depth analysis of the LINQ framework (four: IQueryable, IQueryProvider interface details)
选中按钮上色
ES6 新特性:Class 的基本语法
HCIP第十二天_二层MPLS实验
monkey 压测
qt opengl 使用不同的颜色绘制线框三角形
