Correct way to quit a Qt program?

前端 未结 6 1471
半阙折子戏
半阙折子戏 2020-12-04 08:07

How should I quit a Qt Program, e.g when loading a data file, and discovered file corruption, and user need to quit this app or re-initiate data file?

Should I:

6条回答
  •  有刺的猬
    2020-12-04 08:51

    //How to Run App
    
    bool ok = QProcess::startDetached("C:\\TTEC\\CozxyLogger\\CozxyLogger.exe");
    qDebug() <<  "Run = " << ok;
    
    
    //How to Kill App
    
    system("taskkill /im CozxyLogger.exe /f");
    qDebug() << "Close";
    

    example

提交回复
热议问题