Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Need startSystem Move and startSystemResize method, upgrade Qt from 5.13.2 to 5.15.2. However, QWebEnginePage::runJavaScript cannot run in QThread after the upgrade. It runs fine on 5.13.2



  • Just like the title, I upgraded Qt from 5.13.2 to 5.15.2 because I wanted to use 5.15 startSystemMove and startSystemResize, but I couldn't run QWebEnginePage::runJavaScript on QThread after the upgrade. It worked well in 5.13.2. This is a small example to reproduce my problem. Any suggestions or help would be greatly appreciated. Or the suggestion to move startSystemMove and startSystemResize from Qt5.15.2 to Qt5.13.2

    #include <QThread>
    #include <QApplication>
    #include <QMainWindow>
    #include <QWebEngineView>
    #include <QUrl>
    #include <QDebug>
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
        QMainWindow window;
        auto *browser = new QWebEngineView();
        browser->load(QUrl("https://forum.qt.io/"));
        window.setCentralWidget(browser);
        auto *downloadThread = QThread::create([&]() {
            qDebug()<<"start thread";
            browser->page()->runJavaScript("console.error('download in thread');");
            qDebug()<<"end thread";
        });
        downloadThread->start();
        window.show();
        return QApplication::exec();
    }
    

    In Qt5.15.2 output:

    start thread
    13:49:47: The program has unexpectedly finished.
    13:49:47: The process was ended forcefully.
    

    In Qt5.13.2 output:

    start thread
    end thread
    js: download in thread
    

    Any suggestions or help would be greatly appreciated.



  • Or build Qt5.15.2 + QtWebEngine5.13.2 implementation?



  • Temporarily use QWebEngineDownloadItem to achieve download


Log in to reply