公告
财富商城
积分规则
提问
发文
2019-01-07 22:30发布
狗以群分
i just asking myself how to restart my own qt application?
Can somebody please show me an example?
Doing a real process restart without subclassing:
QCoreApplication a(argc, argv); int returncode = a.exec(); if (returncode == -1) { QProcess* proc = new QProcess(); proc->start(QCoreApplication::applicationFilePath()); } return returncode;
Edit for Mac OS like earlier example.
To restart call
QCoreApplication::exit(-1);
somewhere in your code.
To restart application, try:
#include <QApplication> #include <QProcess> ... // restart: qApp->quit(); QProcess::startDetached(qApp->arguments()[0], qApp->arguments());
最多设置5个标签!
Doing a real process restart without subclassing:
Edit for Mac OS like earlier example.
To restart call
somewhere in your code.
To restart application, try: