I want (in Linux) to control desktop recording by activating SimpleScreenRecorder with emulating key press CTRL+SHIFT+R.
I tried this code:
QKeyEvent * eve1 = new QKeyEvent (QEvent::KeyPress,Qt::Key_R,Qt::ControlModifier|Qt::ShiftModifier,"r");
qApp->postEvent ((QObject*)this, (QEvent *)eve1);
QKeyEvent * eve2 = new QKeyEvent (QEvent::KeyRelease,Qt::Key_R,Qt::ShiftModifier|Qt::ControlModifier,"r");
qApp->postEvent ((QObject*)this, (QEvent *)eve2);
But this does not work. I can send key press event to ui->lineEdit but a can't send it to another running application in this case SimpleScreenRecorder.
How can I solve this problem? Thanks.
void MainWindow::on_pushButton_clicked()
{
system("xdotool key \"control+shift+r\"");
}