Planned maintenance: From Sunday 8th December 10:00 CET there will be changes to try and solve the caching issues that have been experienced. If anyone has a problem connecting after this period then please PM @AndyS or any of the moderators.

QWebEngineView closing



  • Hello,

    I'm using a QWebEngineView inside a dylib library, to display an HTML page. Here a code extraction I used to create my View:

    QWebEngineView *pView = new QWebEngineView();
    
    OAuthUrlRequestInterceptor oauthInt(this, (clientSecret.size() > 0 ? code : implicit), "", pView);
    
    pView->setWindowFlags(Qt::Window | Qt::WindowCloseButtonHint);
    pView->setWindowModality(Qt::ApplicationModal);
    pView->setAttribute(Qt::WA_DeleteOnClose);
    
    pView->page()->profile()->setRequestInterceptor(&oauthInt);
    
    pView->resize(800, 600);
    
    pView->load(QUrl(str));
    pView->show();
    
    while (true)
    {
        if (oauthInt.isFinished() || !pView->isVisible())
            break;
    
        QApplication::processEvents(QEventLoop::AllEvents, 250);
    }
    
    pView->hide();
    pView->close();
    delete pView;
    

    If the user close the View with close button, I have no problems. If I want to close the View programmatically, the window is closed too. I cannot close the application which is calling my dylib. Inside the OAuthUrlRequestInterceptor I recognize a specific URL, then the isFinished() method returns TRUE value, and I exit from the while loop. It seems that something is not correctly closed, or some events are not correctly catch and the application cannot be closed (the File Exit menu item is grayed). In both cases the QtWebEngineProcess is closed, but if the View is not closed with the Close system button I cannot close my application. I'm using QT 5.13 under MAC OS High Sierra.

    Thanks
    Giuseppe