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