QT4:如何重新启动应用程序?重新设置? [英] QT4: How to restart application? Reset settings?

查看:192
本文介绍了QT4:如何重新启动应用程序?重新设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1。)我想重新启动我的QT4应用程序。只是一个正常的关机和启动相同的应用程序。

1.) I would like to restart my QT4 application. Just a normal shutdown and start of the same application.

2)为什么?我需要一个选项来重置一切。重新启动应用程序似乎是最简单的方法来做到这一点。问题是,有很多类和一切。我没有时间把他们的每一个设置回到标准,每个textBox,Widget清除...我知道应用程序重新启动不是最好的方法,你认为有什么另一种方式?

2.) Why? Well i need an Option to "reset" everything. To restart the application seems to be the easiest way to do this. The problem is, that there are a LOT of classes and everything. I dont have the time to put every setting of them back to standard, every textBox, Widget to clear... I Know application restart is not the best way, what do you think is there another way?

谢谢

推荐答案

对于重新启动应用程序,您可以使用 startDetached 退出过程后:

For restarting an application you can use startDetached after quiting the process:

#include <QApplication>
#include <QProcess>

...

// restart the app:
qApp->quit();
QProcess::startDetached(qApp->arguments()[0], qApp->arguments());

这篇关于QT4:如何重新启动应用程序?重新设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆