Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. Properly initialize WebEngineView
QtWS25 Last Chance

Properly initialize WebEngineView

Scheduled Pinned Locked Moved Unsolved QtWebEngine
4 Posts 3 Posters 379 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    S0ulM1ke
    wrote on 1 Feb 2024, 14:09 last edited by
    #1

    I've decided to add YouTube video playback feature in my app (in QML), so I choose WebEngineView

    As I watched the documentation I do this in main.cpp :

        QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
        QtWebEngineQuick::initialize();
    

    Before initializing QCoreApplication.

    And in my view i use this:

    import QtWebEngine 1.10
    ...
                            WebEngineView {
                                width: 600
                                height: 300
                                Component.onCompleted: {
                                    url = model.gameVideoUrl
                                }
                            }
    ...
    

    This works but I have this message in output (happens when item initializes):

    QWebEngineFileSystemAccessRequest is neither a QObject, nor default- and copy-constructible. You should not use it as a QML type.
    QWebEngineCertificateError is neither a QObject, nor default- and copy-constructible. You should not use it as a QML type.
    QWebEngineFullScreenRequest is neither a QObject, nor default- and copy-constructible. You should not use it as a QML type.
    QWebEngineLoadingInfo is neither a QObject, nor default- and copy-constructible. You should not use it as a QML type.
    

    What am I doing wrong?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Drazz
      wrote on 24 Mar 2025, 09:50 last edited by
      #2

      Does anyone know why this warnings appear?

      J 1 Reply Last reply 24 Mar 2025, 10:17
      0
      • D Drazz
        24 Mar 2025, 09:50

        Does anyone know why this warnings appear?

        J Offline
        J Offline
        JonB
        wrote on 24 Mar 2025, 10:17 last edited by JonB
        #3

        @Drazz
        Seemingly same as https://github.com/OmixVisualization/qtjambi/issues/94#issuecomment-1290511207 ?
        I don't know whether QCoreApplication (rather than QApplication) is enough for your purposes, but what happens if you do it before the QtWebEngineQuick::initialize();?
        Otherwise is it a harmless warning which should just be ignored, because of the order of initialization?

        1 Reply Last reply
        0
        • D Offline
          D Offline
          Drazz
          wrote on 24 Mar 2025, 11:09 last edited by
          #4

          Thanks for your answer.

          In my case, I've tested WebEngine Quick Nano Browser example using Qt 6.4.3. It uses QGuiApplication and QtWebEngineQuick::initialize is called before creating the application instance.

          If I move QtWebEngine::initialize() below QGuiApplication, I not only get the same warnings but also an additional message:

          QtWebEngineQuick::initialize() called with QCoreApplication object already created and should be called before. This is deprecated and may fail in the future.
          

          I like to take care of warnings whenever possible, as they can indicate potential issues. Is there any official explanation for these specific warnings?

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved