Correct way to quit a Qt program?

前端 未结 6 1535
半阙折子戏
半阙折子戏 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:45

    if you need to close your application from main() you can use this code

    int main(int argc, char *argv[]){
    QApplication app(argc, argv);
    ...
    if(!QSslSocket::supportsSsl()) return app.exit(0);
    ...
    return app.exec();
    }
    

    The program will terminated if OpenSSL is not installed

提交回复
热议问题