Congratulations to our 2022 Qt Champions!

Running QWebPage in a QThread

  • 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;

  • Lifetime Qt Champion

    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.

Log in to reply