设定槽函数,然后调用QProcess类的start方法即可 void widget::wprocess(){ QProcess *pro = new QProcess; pro->start("shutdown -r now"); }