May 26, 2011

Dieter Dieter
Lab Rat
93 posts

[solved] Restart a Qt application

 

What would be the proper way to restart a Qt application.
After a fatal error the application should offer an option to restarting itself again and I was wondering how this should be done in Qt?

3 replies

May 26, 2011

Luca Luca
Ant Farmer
590 posts

I actually use this:

  1. void MyApp::restartApp()
  2. {
  3.     QProcess::startDetached(QApplication::applicationFilePath());
  4.     exit(12);
  5. }

June 15, 2011

Dieter Dieter
Lab Rat
93 posts

Thank you!
This is exactly what I was looking for.

January 13, 2012

balab balab
Lab Rat
1 posts

works perfectly.Cheers

 
  ‹‹ "https"[protocol] page load on "debug" build on 4.7.0[qt] and won’t on 4.7.3[qt] version.      How to get the event source of a QMenu which is bind to some QPushButtons? ››

You must log in to post a reply. Not a member yet? Register here!