当前位置:网站首页>Qt调节Win屏幕亮度和声音大小
Qt调节Win屏幕亮度和声音大小
2022-07-03 17:14:00 【奋斗小鹏】
一. 前言
最近项目需要,特地学了一下,如何使用Qt来编写一个小工具,可以方便的调节,电脑屏幕的亮度和声音的大小(可以防止电脑上的这两个按键坏了,备用)。
需要的可以关注微信公众号 FPGA之旅 回复
QT调节屏幕亮度和声音大小
--------------------------------------------------------------获取完整工程
二.界面效果
这里作为一个demo分享给大家,Qt是没有自带这些调节功能的,需要调节Win提供的API。然后调节屏幕亮度还需要需要一个开源库。
项目文件结构,标注出来的是个开源库,可以很方便的使用其来调节屏幕亮度
核心代码也很简单,可以根据自己的需求来美化界面。有问题的可以私聊我。
/*根据滑块的值修改Win10的音量*/
connect(ui->horizontalSlider,&QSlider::valueChanged,this,[=](int value)
{
volume.SetSystemVolume(value);
});
/*根据按键,来设置静音或者取消静音*/
connect(ui->pushButton,&QPushButton::clicked,this,[=]()
{
if(flagVolume == 1)
{
volume.SetSystemVolume(-1);
flagVolume = 0;
}
else
{
volume.SetSystemVolume(-2);
flagVolume = 1;
}
});
/*根据滑块的值修改Win10的亮度*/
connect(ui->horizontalSlider_2,&QSlider::valueChanged,this,[=](int value)
{
screen.SetScreenBrightness(value);
});
边栏推荐
- C语言字符串练习
- Electronic technology 20th autumn "Introduction to machine manufacturing" online assignment 3 [standard answer]
- C language string inversion
- Apache服务挂起Asynchronous AcceptEx failed.
- 绝对定位时元素水平垂直居中
- Bcvp developer community 2022 exclusive peripheral first bullet
- 汇编实例解析--实模式下屏幕显示
- Meituan side: why does thread crash not cause JVM crash
- visual studio “通常每个套接字地址(协议/网络地址/端口)只允许使用一次“
- 聊聊接口优化的几个方法
猜你喜欢
One brush 149 force deduction hot question-10 regular expression matching (H)
建立自己的网站(23)
[RT thread] NXP rt10xx device driver framework -- Audio construction and use
【RT-Thread】nxp rt10xx 设备驱动框架之--rtc搭建和使用
【RT-Thread】nxp rt10xx 设备驱动框架之--Audio搭建和使用
Meituan side: why does thread crash not cause JVM crash
2021 ICPC regional competition (Shanghai) g.edge groups (tree DP)
[JDBC] API parsing
聊聊接口优化的几个方法
Kubernetes resource object introduction and common commands (V) - (NFS & PV & PVC)
随机推荐
Thread pool: the most common and error prone component of business code
RedHat 6.2 configuring ZABBIX
[combinatorics] recursive equation (example 1 of recursive equation | list recursive equation)
跨境电商:外贸企业做海外社媒营销的优势
One brush 148 force deduction hot question-5 longest palindrome substring (m)
On Lagrange interpolation and its application
Why is WPA3 security of enterprise business so important?
Bcvp developer community 2022 exclusive peripheral first bullet
【JokerのZYNQ7020】DDS_ Compiler。
HP 阵列卡排障一例
29:第三章:开发通行证服务:12:开发【获得用户账户信息,接口】;(使用VO类包装查到的数据,以符合接口对返回数据的要求)(在多处都会用到的逻辑,在Controller中可以把其抽成一个共用方法)
美团一面:为什么线程崩溃崩溃不会导致 JVM 崩溃
远程办公之如何推进跨部门项目协作 | 社区征文
图之深度优先搜索
[mathematical logic] equivalent calculus and reasoning calculus of propositional logic (propositional logic | equivalent calculus | principal conjunctive (disjunctive) paradigm | reasoning calculus)**
Cross border e-commerce: advantages of foreign trade enterprises in overseas social media marketing
Kubernetes resource object introduction and common commands (4)
【RT-Thread】nxp rt10xx 设备驱动框架之--Pin搭建和使用
大变局!全国房价,跌破万元大关
Examination questions for the assignment of selected readings of British and American Literature in the course examination of Fujian Normal University in February 2022