over 7 years ago
Sometimes we may need to change the brightness of screen in code.
How to make it happen?
Using the QProcess can help you to do that!
QString program = "bkltctl";
QProcess myProcess = new QProcess(this);
QStringList arguments;
arguments << "brightness" << "set_brightness" << "display" << "50"; (50 is the value you want).
myProcess->start(program, arguments);
PS. You may need to connect SINGAL readyReadStandardError(), readyReadStandardOutput() and finished(int, QProcess::ExitStatus) in order to get the output error or result. :)
Enjoy it!