4

I currently have an Android program that starts up and then loads new settings but when the settings are loaded and new settings the application needs to restart to use these new settings. My question is how does one restart an android application using qt and c++ I have seen some ways to do it in java but I can’t seem to find any way to do it from c++ in qt. Thank you for the help!

kobihudson
  • 155
  • 1
  • 12

1 Answers1

0

This post described a solution: how to restart my own qt application?

Getting the executable/name of your program can be done using QApplication::instance()->arguments()[0]; http://doc.qt.io/qt-5/qcoreapplication.html#arguments

#include <QApplication>
#include <QProcess>

....//inside function

  QApplication* qApp = QApplication::instance();
  qApp->quit();
  QProcess::startDetached(qApp->arguments()[0], qApp->arguments());
}
Community
  • 1
  • 1
user2836202
  • 641
  • 3
  • 12