In Qt, what happens to an object when a thread finishes?

Viewed 361

I have a simple QObject:

class Engine : public QObject
{
    Q_OBJECT
public:
    explicit Engine(QObject* parent = 0);
signals:
    void finished();
public slots:
    void start();
};

An instance Engine* engine is stored inside the main window class. When a button is pressed, the following happens:

QThread* thread = new QThread;
engine->moveToThread(thread);
connect(engine, SIGNAL(error(QString)), this, SLOT(errorString(QString)));
connect(thread, SIGNAL(started()), engine, SLOT(start()));
connect(engine, SIGNAL(finished()), thread, SLOT(quit()));
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
thread->start();

My question is, what happens to engine after thread finishes? Can I create another thread and move engine to that thread, and repeat everything again?

1 Answers
Related