Yes, I have something to add - you're wrong, the signal gets emitted.
#include <QtCore>
Q_OBJECT
public:
Test(){}
public slots:
void onFinished() {
qDebug() << Q_FUNC_INFO;
}
};
#include "main.moc"
int main(int argc, char **argv) {
Test test;
QObject::connect(&thread,
SIGNAL(finished
()),
&test,
SLOT(onFinished
()));
thread.start(); // calls "exec()"
QTimer::singleShot(1000,
&thread,
SLOT(quit
()));
return app.exec();
}
#include <QtCore>
class Test : public QObject {
Q_OBJECT
public:
Test(){}
public slots:
void onFinished() {
qDebug() << Q_FUNC_INFO;
}
};
#include "main.moc"
int main(int argc, char **argv) {
QCoreApplication app(argc, argv);
QThread thread;
Test test;
QObject::connect(&thread, SIGNAL(finished()), &test, SLOT(onFinished()));
thread.start(); // calls "exec()"
QTimer::singleShot(1000, &thread, SLOT(quit()));
return app.exec();
}
To copy to clipboard, switch view to plain text mode
./tth
void Test::onFinished()
Bookmarks