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. inizialize
Forum Updated to NodeBB v4.3 + New Features

inizialize

Scheduled Pinned Locked Moved Solved QtWebEngine
12 Posts 2 Posters 3.2k Views 1 Watching
  • 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.
  • elicatE elicat

    I have this error in my app.

    QtWebEngine::initialize() must be called after the construction of the application object.
    

    But I have put intialize after .. Whay this ?

    9a9953a4-2b67-4324-a947-b9bef6774a45-image.png

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by
    #2

    @elicat
    https://doc.qt.io/qt-5/qtwebengine.html#initialize states:

    Sets up an OpenGL Context that can be shared between threads. This has to be done before QGuiApplication is created and before window's QPlatformOpenGLContext is created.

    So I don't know about the error message, but the docs state before, and that's where I do mine. Try swapping the order!?

    1 Reply Last reply
    0
    • elicatE Offline
      elicatE Offline
      elicat
      wrote on last edited by elicat
      #3

      @JonB said in inizialize:

      So I don't know about the error message, but the docs state before, and that's where I do mine. Try swapping the order!?

      I have try several times. the result it's same

      88d44884-b637-4fd3-9ee5-d5c8a8b301d7-image.png

      6b58c39b-99b6-4236-a2b2-2a2fed8062d2-image.png

      Saluti, Gianfranco Elicat

      JonBJ 1 Reply Last reply
      0
      • elicatE elicat

        @JonB said in inizialize:

        So I don't know about the error message, but the docs state before, and that's where I do mine. Try swapping the order!?

        I have try several times. the result it's same

        88d44884-b637-4fd3-9ee5-d5c8a8b301d7-image.png

        6b58c39b-99b6-4236-a2b2-2a2fed8062d2-image.png

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #4

        @elicat
        Hmm. I don't even use that function. Are you using Qt Quck, or just standard widgets? Because that doc above sates:

        Helper functions for the Qt WebEngine (Qt Quick) module

        ? Because all I do (I'm afraid I'm Python/PyQt5) is:

            # next line required to avoid
            #   "QtWebEngineWidgets must be imported before a QCoreApplication instance is created", or related problem
            try:
                from PyQt5.QtWebEngineWidgets import QWebEngineView
            except:
                pass
        
            # create the QGuiApplication
            app = QtWidgets.QApplication(sys.argv)
        
        1 Reply Last reply
        0
        • elicatE Offline
          elicatE Offline
          elicat
          wrote on last edited by elicat
          #5

          @JonB said in inizialize:

          Hmm. I don't even use that function. Are you using Qt Quck, or just standard widgets? Because that doc above sates:

          I don't use widgets. For My project i use QML and inside I set webengine e dynamic url.
          I use QT Tools Into VisualStudio Comunity 2017

          218d9e46-1430-4b26-bf77-a4fe8d7bf32f-image.png

          Saluti, Gianfranco Elicat

          JonBJ 1 Reply Last reply
          0
          • elicatE elicat

            @JonB said in inizialize:

            Hmm. I don't even use that function. Are you using Qt Quck, or just standard widgets? Because that doc above sates:

            I don't use widgets. For My project i use QML and inside I set webengine e dynamic url.
            I use QT Tools Into VisualStudio Comunity 2017

            218d9e46-1430-4b26-bf77-a4fe8d7bf32f-image.png

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #6

            @elicat
            Apologies, I had no idea you were using QML. You'll have to await another responder.

            1 Reply Last reply
            0
            • elicatE Offline
              elicatE Offline
              elicat
              wrote on last edited by elicat
              #7

              Thanks, however the problem is not the QML but the initialization command.
              I hope resolve it quickly

              Saluti, Gianfranco Elicat

              JonBJ 2 Replies Last reply
              0
              • elicatE elicat

                Thanks, however the problem is not the QML but the initialization command.
                I hope resolve it quickly

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #8

                @elicat
                The initialization command is only used from Qt Quick/QML. From Qt widgets I have no initialization command and it works fine....

                1 Reply Last reply
                0
                • elicatE elicat

                  Thanks, however the problem is not the QML but the initialization command.
                  I hope resolve it quickly

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by JonB
                  #9

                  @elicat
                  OK, did you try Googling for QML QWebEngine...? Because there is an example I see at https://doc.qt.io/qt-5/qml-qtwebengine-webengineview.html:

                  Initializing Web Engine

                  For the web engine view to be rendered, the web engine must be initialized by using QtWebEngine::initialize in the application main source file, as illustrated by the following code snippet:

                  int main(int argc, char *argv[])
                  {
                      QCoreApplication::setOrganizationName("QtExamples");
                      QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
                      QtWebEngine::initialize();
                      QGuiApplication app(argc, argv);
                  
                      QQmlApplicationEngine engine;
                      engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
                  
                      return app.exec();
                  }
                  

                  As I originally suggested, it seems to call the initialize() before the QGuiApplication(). Try the above code, at least to see whether you get the error you report?

                  1 Reply Last reply
                  0
                  • elicatE Offline
                    elicatE Offline
                    elicat
                    wrote on last edited by elicat
                    #10

                    @JonB said in inizialize:

                    As I originally suggested, it seems to call the initialize() before the QGuiApplication(). Try the above code, at least to see whether you get the error you report?

                    My code it's same this.

                    I have two strange things.

                    1. The QtWebEngine class is recognized but not highlighted as a class
                    2. if I delete the initialization line the application starts and works

                    Obviously it's not a correct thing and it's clear so I'm trying to understand

                    82e203d0-f00a-4675-9b3c-b3b843fb5e8e-image.png

                    Saluti, Gianfranco Elicat

                    elicatE 1 Reply Last reply
                    0
                    • elicatE elicat

                      @JonB said in inizialize:

                      As I originally suggested, it seems to call the initialize() before the QGuiApplication(). Try the above code, at least to see whether you get the error you report?

                      My code it's same this.

                      I have two strange things.

                      1. The QtWebEngine class is recognized but not highlighted as a class
                      2. if I delete the initialization line the application starts and works

                      Obviously it's not a correct thing and it's clear so I'm trying to understand

                      82e203d0-f00a-4675-9b3c-b3b843fb5e8e-image.png

                      elicatE Offline
                      elicatE Offline
                      elicat
                      wrote on last edited by
                      #11

                      @elicat Nobody have idea?
                      If I insert the initialization line, before or after "QGuiApplication app", the error is reported to me (see previous post), why?
                      If I delete the webengine initialization line the program works (in QT 511.1), why is this possible?

                      Saluti, Gianfranco Elicat

                      1 Reply Last reply
                      0
                      • elicatE Offline
                        elicatE Offline
                        elicat
                        wrote on last edited by
                        #12

                        I have solved when installed version QT 5.14.0

                        Saluti, Gianfranco Elicat

                        1 Reply Last reply
                        0

                        • Login

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