-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.7.0
-
None
-
Mac OS X 10.11.6 (15G31)
I am trying to build c++ command line application (NO UI) to fetch some remote webpage. I was able to build application just fine. But when I start debugging I get this error when I try to initialize QWebEnginePage.
The error message I get is "WebEngineContext used before QtWebEngine::initialize()". So I added it in main(). Here is sample
int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); QtWebEngine::initialize(); // Task parented to the application so that it // will be deleted by the application. ProcessRequest *task = new ProcessRequest( &app ); // This will cause the application to exit when // the task signals finished. QObject::connect(task, SIGNAL(finished()), &app, SLOT(quit())); // This will run the task from the application event loop. QTimer::singleShot(0, task, SLOT(run())); app.exec(); }
Even after calling QtWebEngine::initialize() I still get same message.
void ProcessRequest::run() { QWebEnginePage page; connect(&page, SIGNAL(urlChanged(const QUrl&)), SLOT(urlChanged())); page.load("http://www.google.com"); page.toHtml([](const QString &result){ qInfo() << result; }); }