In a QThread based class, I have a QWebPage, when loadFinished(), I need to parse the contents, it would stuck the UI. So I put everything in a thread:
class Thread: public QThread
{
public:
Thread (QObject *p): QThread (p)
{
moveToThread (this);
connect (&page, SIGNAL(loadFinished(bool)), SLOT(loadFinished(bool)));
}
private slots:
void loadFinished (bool ok)
{
// never get called, unless I remove the `moveToThread(this)`
}
};
I also tried to move the event of QWebPage to this qthread based class as well, I got errors, seems you can't move the event to a new thread.
Any ideas on it?