Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-55068

WebEngineContext used before QtWebEngine::initialize()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.7.0
    • WebEngine
    • 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; });
      }
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt_webengine_team Qt WebEngine Team
            oxoocoffee Robert J. Gebis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes