当前位置:网站首页>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);
});
边栏推荐
- 29: Chapter 3: develop Passport Service: 12: develop [obtain user account information, interface]; (use VO class to package the found data to meet the requirements of the interface for the returned da
- C language string practice
- Kubernetes resource object introduction and common commands (III)
- Apache service suspended asynchronous acceptex failed
- 線程池:業務代碼最常用也最容易犯錯的組件
- New library online | cnopendata complete data of Chinese insurance institution outlets
- Necessary ability of data analysis
- How SVN views modified file records
- 比亚迪、长城混动市场再“聚首”
- 27. 输入3个整数,按从大到小的次序输出。要求用指针方法实现。
猜你喜欢

【RT-Thread】nxp rt10xx 设备驱动框架之--Audio搭建和使用

新库上线 | CnOpenData中国保险机构网点全集数据
The way of wisdom (unity of knowledge and action)

Why is WPA3 security of enterprise business so important?

Collection of the most beautiful graduation photos in the graduation season, collection of excellent graduation photos

Recommendation of good books on learning QT programming

Life is still confused? Maybe these subscription numbers have the answers you need!

Redis: operation commands for list type data
![[UE4] brush Arctic pack high quality Arctic terrain pack](/img/e7/bc86bd8450b0b2bdec8980a2aa1a10.jpg)
[UE4] brush Arctic pack high quality Arctic terrain pack

聊聊接口优化的几个方法
随机推荐
Electronic Science and technology 20th autumn "Microcomputer Principle and application" online assignment 2 [standard answer]
Leetcode13. Roman numeral to integer (three solutions)
Kotlin学习快速入门(7)——扩展的妙用
LeetCode13.罗马数字转整数(三种解法)
聊聊接口优化的几个方法
浅谈拉格朗日插值及其应用
One brush 144 force deduction hot question-1 sum of two numbers (E)
美团一面:为什么线程崩溃崩溃不会导致 JVM 崩溃
匯編實例解析--實模式下屏幕顯示
RedHat 6.2 configuring ZABBIX
Thread pool: the most common and error prone component of business code
University of Electronic Science and technology, accounting computerization, spring 20 final exam [standard answer]
How SVN views modified file records
Great changes! National housing prices fell below the 10000 yuan mark
Dagong 21 autumn "power plant electrical part" online operation 1 [standard answer] power plant electrical part
Swm32 series Tutorial 4 port mapping and serial port application
[2. Basics of Delphi grammar] 1 Identifiers and reserved words
Why is WPA3 security of enterprise business so important?
Solution to long waiting time of SSH connection to remote host
2021 ICPC regional competition (Shanghai) g.edge groups (tree DP)