使用QProcess 完成linux关机

 
void Parse::sysshutdown()
{
   // Mymethod::record(QString("Switch machine message received"));
  QProcess *parent;
  QString program = "sudo";
  QStringList arguments;
  arguments << "poweroff";
  QProcess *myProcess = new QProcess(parent);
  myProcess->start(program,arguments);
}
 
posted @ 2021-07-16 00:33  Azuki_op  阅读(214)  评论(0)    收藏  举报