qt android quit app
-
im trying quit my current app from a thread...
#include <QThread> class WorkerThread : public QThread { void run() override { qDebug() << "hello world from thread"; sleep(5000); //app.quit(); <= need close app here } }; func main(){ /* some stuff that create QML interface.... */ //create thread WorkerThread *workerThread = new WorkerThread(); workerThread->start(); app.exect() }
but isn't working... obviusly need reference of app to execute quit function but inside thread i cant pass it like a parameter. is there a way to quit my app without
QGuiApplication app
reference -
@0xNull said in qt android quit app:
but isn't working...
that quit() method is static, you are calling it on an object which is an instance. Don't do that. Try to avoid calling static methods on objects and instead fully specify the name. Like so;
QApplication::quit();
See docs at; https://doc.qt.io/qt-6/qcoreapplication.html#quit