Running QWebPage in a QThread
Unsolved
General and Desktop
-
I tried to run
QWebPage
in a thread and I'm getting this warning:QObject: Cannot create children for a parent that is in a different thread.
It's really simple the code:
void Thread::run() { auto page = new QWebPage; page->mainFrame()->load(QNetworkRequest(QUrl("http://google.com"))); }
-
It is not allowed to use UI related Qt classes in a different thread. They all must be used in the same thread in which the event loop is executed.
Why do you want to use QWebPage in a different thread?
As far as I know the UI of your application should not block while the web page is loaded.