Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Compiling QtWebengine without QtQuick dependancy.
QtWS25 Last Chance

Compiling QtWebengine without QtQuick dependancy.

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
20 Posts 3 Posters 482 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.
  • J Offline
    J Offline
    JulienMaille
    wrote on 11 Apr 2025, 16:11 last edited by JulienMaille
    #1

    Hello fellow Qt gurus.
    I'm porting away from QWebkit to QtWebengine, still under Qt5.15.16
    It's been a journey to compile QtWebengine (most tutorials don't mention the Node.js dependency that was added with Qt5.15.2) but it finally succeeded.
    My issue thought is that I had to remove the "-skip qdeclarative" flag when calling configure.bat
    I have no use of QML and stuff related, so I was wondering how I can do to remove any dependency to those modules while preserving proper QtWebengine compilation.
    Google has not been my friend with this request, so any input will be appreciated. Thanks!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote 30 days ago last edited by
      #2

      Hi,

      From a quick look, you have to disable the qtwebengine_quick_build feature.

      Something along the line off:

      qt-cmake -DFEATURE_qtwebengine_quick_build=OFF
      

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JulienMaille
        wrote 30 days ago last edited by JulienMaille 4 Nov 2025, 19:47
        #3

        Thank you I will try that, may I ask where you have looked to find this tip?
        I can't find such reference in Qt5.15.16 source code.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote 30 days ago last edited by
          #4

          Sorry !

          Somehow I lost view on the fact that it was for Qt 5.
          I think it was webengine-qml for it.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • J Offline
            J Offline
            JulienMaille
            wrote 30 days ago last edited by
            #5

            I already use that flag unfortunately

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote 29 days ago last edited by
              #6

              Just a note, the feature system is not fully tested as it would require way too many permutations.

              Taking a look at the code again, it looks like qml is currently in fact not optional or would require changes to the sources.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • J Offline
                J Offline
                JulienMaille
                wrote 29 days ago last edited by JulienMaille 4 Dec 2025, 09:49
                #7

                May I ask again where and how to look, this way I can find information on my own next time I'm stuck :)
                I see here that core_common.pri does not have flags to prevent qml and quick SUBDIRS
                https://github.com/qt/qtwebengine/blob/badd899444e3eb597323864c4885493dea51564b/src/core/core_common.pri#L9

                By the way, adding webengine-qml results in configure to return

                Note: The following modules are not being compiled in this configuration:
                    webengine
                
                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote 29 days ago last edited by
                  #8

                  You can start from the configure options.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    JKSH
                    Moderators
                    wrote 28 days ago last edited by JKSH
                    #9

                    @JulienMaille said in Compiling QtWebengine without QtQuick dependancy.:

                    I was wondering how I can do to remove ant dependancy to those module while preserving proper QtWebengine compilation.

                    Unfortunately, it's impossible to build Qt WebEngine without qtdeclarative.

                    QWebEngineView uses an internal QQuickWidget to render the browser content: https://github.com/qt/qtwebengine/blob/v5.15.18-lts/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp#L97-L98

                    Qt R&D tried but failed to find a way to remove QQuickWidget from QWebEngineView: https://bugreports.qt.io/browse/QTBUG-85236

                    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                    1 Reply Last reply
                    1
                    • J Offline
                      J Offline
                      JulienMaille
                      wrote 27 days ago last edited by
                      #10

                      @JKSH Thank you very much for that insight. My need is to convert html to pdf, I don't need the complete features provided by QtWebEngine. Maybe I should try with Qt6 since the QWebEnginePage class was moved to QWebEngineCore which should not rely on qtdeclarative. Do you have more tips to share?

                      J 1 Reply Last reply 26 days ago
                      0
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote 27 days ago last edited by
                        #11

                        Did you already checked QtPdf ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        J 1 Reply Last reply 27 days ago
                        0
                        • S SGaist
                          27 days ago

                          Did you already checked QtPdf ?

                          J Offline
                          J Offline
                          JulienMaille
                          wrote 27 days ago last edited by JulienMaille
                          #12

                          @SGaist Well I thought QtPdf was not standalone and was required by QtWebengine to render pdf? Am I wrong? So that's when your input is pdf, in my case input is html and output is pdf.

                          1 Reply Last reply
                          0
                          • J JulienMaille
                            27 days ago

                            @JKSH Thank you very much for that insight. My need is to convert html to pdf, I don't need the complete features provided by QtWebEngine. Maybe I should try with Qt6 since the QWebEnginePage class was moved to QWebEngineCore which should not rely on qtdeclarative. Do you have more tips to share?

                            J Offline
                            J Offline
                            JKSH
                            Moderators
                            wrote 26 days ago last edited by
                            #13
                            • Chromium contains its own internal PDF libraries for viewing and printing PDFs (pdfium). Qt WebEngine makes use of this directly, without depending on Qt PDF.
                            • Qt PDF is a standalone module for viewing PDF documents only (not printing). It can be used on platforms that can't use Qt WebEngine.

                            @JulienMaille said in Compiling QtWebengine without QtQuick dependancy.:

                            Maybe I should try with Qt6 since the QWebEnginePage class was moved to QWebEngineCore which should not rely on qtdeclarative. Do you have more tips to share?

                            You're welcome.

                            Alas, even if you only depend on Qt WebEngine Core but not Qt WebEngine (Widgets|Quick), your deployment will still have a dependency on Qt Quick for some reason (I just tested with Qt 6.8.3, but I haven't figured out why)

                            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                            1 Reply Last reply
                            1
                            • J Offline
                              J Offline
                              JulienMaille
                              wrote 26 days ago last edited by
                              #14

                              Ok, I will stick to Qt5 for now. My first try to load and print pdf using the example https://doc.qt.io/qt-5/qtwebengine-webenginewidgets-html2pdf-example.html was a total failure. Both the load and the print fails, without any error message.
                              I will try recompiling with less -no-feature-webengine-* flags

                              1 Reply Last reply
                              0
                              • S Offline
                                S Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote 26 days ago last edited by
                                #15

                                Sorry for the QtPdf suggestion, I somehow conflated rendering with printing.

                                What kind of document are you trying to create PDF out of ?
                                Depending on that, the QPdfWriter class might be enough.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                0
                                • J Offline
                                  J Offline
                                  JulienMaille
                                  wrote 25 days ago last edited by
                                  #16

                                  @SGaist The document I want to convert to PDF is an "in memory" html+css file.
                                  @JKSH Have you ever tried the html2pdf example? I recompiled Qt in 64bit (I was afraid something was wrong with my x86onx64 build) and this official example still fails to print anything to pdf.
                                  m_page->load(QUrl::fromUserInput(m_inputPath)); return ok=false, and when forcing the htmlSource of m_page with some html code, then m_page->printToPdf(m_outputPath); also results in ok=false.
                                  There are no error codes that I could use to understand where the problem comes from.

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote 25 days ago last edited by
                                    #17

                                    Are you styling things in such a manner that QDocument can handle it ?

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    1 Reply Last reply
                                    0
                                    • J Offline
                                      J Offline
                                      JulienMaille
                                      wrote 25 days ago last edited by
                                      #18

                                      I dunno, I tried printing "<html>hello</html>" to pdf, shouldn't that work?

                                      1 Reply Last reply
                                      0
                                      • S Offline
                                        S Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote 25 days ago last edited by
                                        #19

                                        With QPdfPrinter ? AFAIK, yes.
                                        How did you do it ?

                                        Interested in AI ? www.idiap.ch
                                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                        1 Reply Last reply
                                        0
                                        • J Offline
                                          J Offline
                                          JulienMaille
                                          wrote 25 days ago last edited by
                                          #20

                                          Have a look at https://doc.qt.io/qt-5/qtwebengine-webenginewidgets-html2pdf-example.html it uses neither QDocument nor QPdfPrinter

                                          1 Reply Last reply
                                          0

                                          9/20

                                          14 Apr 2025, 03:20

                                          • Login

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