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. Browsers and Java Script.
Forum Updated to NodeBB v4.3 + New Features

Browsers and Java Script.

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 4 Posters 2.8k Views 2 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 bask185
    #3

    I might or might not have fixed my screenshots, I believe they work now? Damned photobucket no longer works

    Anyways I have a .html file which I need to display. I used a QTextBrowser so far but I have more than just text. QML like you said also does not suffice. So I think I'm gonna try to use a QWebKit browser.

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

      Now I used imgur for the screenshots, lets see if that works.

      The thing you are looking at is a complex html file which I do need to make it work in my Qt application.

      I learned that I need to install the QtWebkit module. I don't have it yet. I tried it using Qt's Maintenance tool but that tool does not work without a commercial license it seems.

      I have seen that that there widgets for a webview as well as a module you can use in combination with QML. The latter I tried and gave me the erros: qrc:/resources/img/webview.qml:3:1: module "QtWebKit" is not installed This was how I found out I don't have this module.

      Are there other ways in how to install missing modules?

      jsulmJ raven-worxR 2 Replies Last reply
      0
      • B bask185

        Now I used imgur for the screenshots, lets see if that works.

        The thing you are looking at is a complex html file which I do need to make it work in my Qt application.

        I learned that I need to install the QtWebkit module. I don't have it yet. I tried it using Qt's Maintenance tool but that tool does not work without a commercial license it seems.

        I have seen that that there widgets for a webview as well as a module you can use in combination with QML. The latter I tried and gave me the erros: qrc:/resources/img/webview.qml:3:1: module "QtWebKit" is not installed This was how I found out I don't have this module.

        Are there other ways in how to install missing modules?

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

        @bask185 said in Browsers and Java Script.:

        Qt's Maintenance tool but that tool does not work without a commercial license

        This is simply wrong. The maintenance tool works just fine here without commercial license. Why do you think it only works with commercial license?
        Actually you should use Qt WebEngine not QtWebKit.

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

        1 Reply Last reply
        0
        • B bask185

          Now I used imgur for the screenshots, lets see if that works.

          The thing you are looking at is a complex html file which I do need to make it work in my Qt application.

          I learned that I need to install the QtWebkit module. I don't have it yet. I tried it using Qt's Maintenance tool but that tool does not work without a commercial license it seems.

          I have seen that that there widgets for a webview as well as a module you can use in combination with QML. The latter I tried and gave me the erros: qrc:/resources/img/webview.qml:3:1: module "QtWebKit" is not installed This was how I found out I don't have this module.

          Are there other ways in how to install missing modules?

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #6

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

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          B 1 Reply Last reply
          1
          • raven-worxR raven-worx

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

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

            @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.

            Thank you,

            I added to the setup of MainWindow:

            QtWebEngine::initialize();
            
            QQmlApplicationEngine engine;
            engine.load(QUrl(QStringLiteral("qrc:/webview.qml")));
            

            And I included: #include <QtWebEngine/QtWebEngine>

            But Imma getting an error message:

            /home/user/Dropbox/GUI/GUI_Qt/mainwindow.cpp:-1: error: undefined reference to `QtWebEngine::initialize()'
            
            mrjjM 1 Reply Last reply
            0
            • B bask185

              @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.

              Thank you,

              I added to the setup of MainWindow:

              QtWebEngine::initialize();
              
              QQmlApplicationEngine engine;
              engine.load(QUrl(QStringLiteral("qrc:/webview.qml")));
              

              And I included: #include <QtWebEngine/QtWebEngine>

              But Imma getting an error message:

              /home/user/Dropbox/GUI/GUI_Qt/mainwindow.cpp:-1: error: undefined reference to `QtWebEngine::initialize()'
              
              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #8

              @bask185 said in Browsers and Java Script.:

              QtWebEngine

              You need
              QT += webengine
              in .pro file

              B 1 Reply Last reply
              3
              • mrjjM mrjj

                @bask185 said in Browsers and Java Script.:

                QtWebEngine

                You need
                QT += webengine
                in .pro file

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

                @mrjj said in Browsers and Java Script.:

                @bask185 said in Browsers and Java Script.:

                QtWebEngine

                You need
                QT += webengine
                in .pro file

                Funny, I recall me saying something about I was not going to forget to include something in .PRO file again -_-"

                Anyways, it works :D

                Now I have to figure out how to place it precisely and how to interact with it.

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

                  Hey speakin' about placing it. The webview thing behaves very oddly when it comes to opening.

                  It either opens at startup or it does not open at all, atleast not without closing immediately.

                  I put these lines in a function which gets called when I push on a button. It opens but it closes immediately.

                  QtWebEngine::initialize();
                  
                  QQmlApplicationEngine engine;
                  engine.load(QUrl(QStringLiteral("qrc:/webview.qml")));
                  

                  And when I add these lines to the setup, the browser opens without closing. Only at this point I dont want the browser to be visable yet. I need to be able to manually open or close the browser. I tried everything but I cannot get this to work :/

                  It also appears to be needing a blank QtQuickWidget somewhere

                  mrjjM 1 Reply Last reply
                  0
                  • B bask185

                    Hey speakin' about placing it. The webview thing behaves very oddly when it comes to opening.

                    It either opens at startup or it does not open at all, atleast not without closing immediately.

                    I put these lines in a function which gets called when I push on a button. It opens but it closes immediately.

                    QtWebEngine::initialize();
                    
                    QQmlApplicationEngine engine;
                    engine.load(QUrl(QStringLiteral("qrc:/webview.qml")));
                    

                    And when I add these lines to the setup, the browser opens without closing. Only at this point I dont want the browser to be visable yet. I need to be able to manually open or close the browser. I tried everything but I cannot get this to work :/

                    It also appears to be needing a blank QtQuickWidget somewhere

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by mrjj
                    #11

                    @bask185 said in Browsers and Java Script.:

                    • It opens but it closes immediately.

                    QtWebEngine::initialize();
                    QQmlApplicationEngine engine;
                    engine.load(QUrl(QStringLiteral("qrc:/webview.qml")));

                    You kill it by running out of scope.
                    As soon as function finishes, the engine variable will die.

                    QQmlApplicationEngine engine; <<< make this a class member

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

                      Done & Solved, tnx again.

                      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