Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Interact with a QQmlApplicationEngine html page.
Forum Updated to NodeBB v4.3 + New Features

Interact with a QQmlApplicationEngine html page.

Scheduled Pinned Locked Moved Solved General and Desktop
18 Posts 3 Posters 5.0k 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.
  • B Offline
    B Offline
    bask185
    wrote on last edited by
    #9

    @jsulm said in Interact with a QQmlApplicationEngine html page.:

    @bask185 Why not just call hide()?

    For once I am on step ahead of you, I think ;) The answer to this question:

    /home/user/Dropbox/GUI/GUI_Qt/mainwindow.cpp:151: error: ‘class QQmlApplicationEngine’ has no member named ‘hide’
       engine->hide();
               ^
    

    The code in the setup is now:

    QtWebEngine::initialize();
    engine->load(QUrl(QStringLiteral("qrc:/resources/img/webview.qml")));
    engine->hide();
    

    @jsulm said in Interact with a QQmlApplicationEngine html page.:

    If you delete it and try to access it later then yes your app will crash as you're trying to access memory you freed before...

    I figured something like that is why I tried to call ::initialize() again before opening. But I believe 'deleteLater()' deletes the object/member I declared in the header file -->> crash ???

    jsulmJ 1 Reply Last reply
    0
    • B bask185

      @jsulm said in Interact with a QQmlApplicationEngine html page.:

      @bask185 Why not just call hide()?

      For once I am on step ahead of you, I think ;) The answer to this question:

      /home/user/Dropbox/GUI/GUI_Qt/mainwindow.cpp:151: error: ‘class QQmlApplicationEngine’ has no member named ‘hide’
         engine->hide();
                 ^
      

      The code in the setup is now:

      QtWebEngine::initialize();
      engine->load(QUrl(QStringLiteral("qrc:/resources/img/webview.qml")));
      engine->hide();
      

      @jsulm said in Interact with a QQmlApplicationEngine html page.:

      If you delete it and try to access it later then yes your app will crash as you're trying to access memory you freed before...

      I figured something like that is why I tried to call ::initialize() again before opening. But I believe 'deleteLater()' deletes the object/member I declared in the header file -->> crash ???

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #10

      @bask185 You cannot call anything on something what was already deleted (deleteLater() deletes the object).

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bask185
        wrote on last edited by bask185
        #11

        @jsulm said in Interact with a QQmlApplicationEngine html page.:

        @bask185 You cannot call anything on something what was already deleted (deleteLater() deletes the object).

        Yes and I scrolled through the list of functions but I cannot find anything which simply closes the webview window

        jsulmJ 1 Reply Last reply
        0
        • B bask185

          @jsulm said in Interact with a QQmlApplicationEngine html page.:

          @bask185 You cannot call anything on something what was already deleted (deleteLater() deletes the object).

          Yes and I scrolled through the list of functions but I cannot find anything which simply closes the webview window

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #12

          @bask185 QWebView is derived from QWidget and QWidget has hide() method

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          B 1 Reply Last reply
          0
          • jsulmJ jsulm

            @bask185 QWebView is derived from QWidget and QWidget has hide() method

            B Offline
            B Offline
            bask185
            wrote on last edited by
            #13

            @jsulm said in Interact with a QQmlApplicationEngine html page.:

            @bask185 QWebView is derived from QWidget and QWidget has hide() method

            But 'member that the thing I am using:

            engine = new QQmlApplicationEngine();
            

            is not derived from a QWidget IIRC.

            I am using this QML file:

            import QtQuick 2.0
            import QtQuick.Window 2.0
            import QtWebEngine 1.0
            
            Window {
                width: 1024
                height: 750
                visible: true
                WebEngineView {
                    anchors.fill: parent
                    url: "qrc:/resources/img/frmSSPeditor.html"
                }
            }
            

            to open the .html

            And I did this because this was recommended to me on this here forum.
            @raven-worx said in Browsers and Java Script.:

            @bask185
            QtWebkit is deprecated in the meantime and has been replaced by QtWebEngine (based on Chromium).
            Try using WebEngineView instead.

            This + I am not seeing the QWebview widget in Qt creator.

            alt text
            No suggestions for hide, can only find 'handle'. I am telling you hide() isn't there

            jsulmJ 1 Reply Last reply
            0
            • B bask185

              @jsulm said in Interact with a QQmlApplicationEngine html page.:

              @bask185 QWebView is derived from QWidget and QWidget has hide() method

              But 'member that the thing I am using:

              engine = new QQmlApplicationEngine();
              

              is not derived from a QWidget IIRC.

              I am using this QML file:

              import QtQuick 2.0
              import QtQuick.Window 2.0
              import QtWebEngine 1.0
              
              Window {
                  width: 1024
                  height: 750
                  visible: true
                  WebEngineView {
                      anchors.fill: parent
                      url: "qrc:/resources/img/frmSSPeditor.html"
                  }
              }
              

              to open the .html

              And I did this because this was recommended to me on this here forum.
              @raven-worx said in Browsers and Java Script.:

              @bask185
              QtWebkit is deprecated in the meantime and has been replaced by QtWebEngine (based on Chromium).
              Try using WebEngineView instead.

              This + I am not seeing the QWebview widget in Qt creator.

              alt text
              No suggestions for hide, can only find 'handle'. I am telling you hide() isn't there

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #14

              @bask185 How did you add that engine to your GUI? Does it have a parent widget? Is it in a layout?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              B 1 Reply Last reply
              0
              • jsulmJ jsulm

                @bask185 How did you add that engine to your GUI? Does it have a parent widget? Is it in a layout?

                B Offline
                B Offline
                bask185
                wrote on last edited by
                #15

                @jsulm said in Interact with a QQmlApplicationEngine html page.:

                @bask185 How did you add that engine to your GUI? Does it have a parent widget? Is it in a layout?

                It has no parent Widgets. In the header file I declare: QQmlApplicationEngine *engine;
                In the setup I initialize it:
                engine = new QQmlApplicationEngine(); //(this action is called initializing right??)
                and I also perform QtWebEngine::initialize();

                In a function I call: engine->load(QUrl(QStringLiteral("qrc:/resources/img/webview.qml")));
                And this line opens a new window with the .qml which opens the .html

                It is not related to any .ui I also have no controll where the window appears. The reso of the target device is that small that it is just right.

                But if you can tell me how to install the QWebview widget in Qt creator, that also works for me.

                jsulmJ 1 Reply Last reply
                0
                • B bask185

                  @jsulm said in Interact with a QQmlApplicationEngine html page.:

                  @bask185 How did you add that engine to your GUI? Does it have a parent widget? Is it in a layout?

                  It has no parent Widgets. In the header file I declare: QQmlApplicationEngine *engine;
                  In the setup I initialize it:
                  engine = new QQmlApplicationEngine(); //(this action is called initializing right??)
                  and I also perform QtWebEngine::initialize();

                  In a function I call: engine->load(QUrl(QStringLiteral("qrc:/resources/img/webview.qml")));
                  And this line opens a new window with the .qml which opens the .html

                  It is not related to any .ui I also have no controll where the window appears. The reso of the target device is that small that it is just right.

                  But if you can tell me how to install the QWebview widget in Qt creator, that also works for me.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #16

                  @bask185 said in Interact with a QQmlApplicationEngine html page.:

                  QWebview

                  Why don't you use http://doc.qt.io/qt-5/qwebengineview.html? QtWebKit is discontinued QWebEngine should be used instead.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  B 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @bask185 said in Interact with a QQmlApplicationEngine html page.:

                    QWebview

                    Why don't you use http://doc.qt.io/qt-5/qwebengineview.html? QtWebKit is discontinued QWebEngine should be used instead.

                    B Offline
                    B Offline
                    bask185
                    wrote on last edited by
                    #17

                    @jsulm Becuz I sometimes have no idea of how to get my stuff to work, hence my presence on this here forum ;)

                    Anways my entire app works like a charm, mostly thanks to your efforts, So thank you!

                    Even the titleChanged() signal works out of the box, I only have to retrieve some information out of a column somewhere

                    jsulmJ 1 Reply Last reply
                    0
                    • B bask185

                      @jsulm Becuz I sometimes have no idea of how to get my stuff to work, hence my presence on this here forum ;)

                      Anways my entire app works like a charm, mostly thanks to your efforts, So thank you!

                      Even the titleChanged() signal works out of the box, I only have to retrieve some information out of a column somewhere

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #18

                      @bask185 Glad to hear it works now :-)

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      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