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. Why the help document does not have a complete example of HTML? I think it's completely guesswork to use it. It seems that it's not completely compatible with html4
Forum Updated to NodeBB v4.3 + New Features

Why the help document does not have a complete example of HTML? I think it's completely guesswork to use it. It seems that it's not completely compatible with html4

Scheduled Pinned Locked Moved Solved General and Desktop
25 Posts 5 Posters 3.5k Views 3 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.
  • D duncan98

    @jsulm
    I know standard HTML, but qt HTML is very confusing

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

    @duncan98 There is no "qt HTML". Qt supports a subset of HTML as @JKSH already pointed out...

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

    1 Reply Last reply
    4
    • D duncan98

      @jsulm
      I know standard HTML, but qt HTML is very confusing

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

      @duncan98 said in Why the help document does not have a complete example of HTML? I think it's completely guesswork to use it. It seems that it's not completely compatible with html4:

      @jsulm
      I know standard HTML, but qt HTML is very confusing

      I have done HTML for many, many years, so I know it too. What is your actual issue with the subset of HTML supported by Qt, e.g. in a QTextEdit?

      You can copy the whole of the HTML content from the https://code.qt.io/cgit/qt/qtbase.git/tree/examples/widgets/richtext/textedit/example.html?h=5.14 example you refer to as a "mess", and as well as pasting it into a QTextEdit to look at it you can also save it to an .html file and open it in your web browser. Since it looks pretty similar there, you know it must be reasonably close to HTML. You can use the browser's F12 or your favorite HTML editor to examine the HTML.

      D 1 Reply Last reply
      2
      • JonBJ JonB

        @duncan98 said in Why the help document does not have a complete example of HTML? I think it's completely guesswork to use it. It seems that it's not completely compatible with html4:

        @jsulm
        I know standard HTML, but qt HTML is very confusing

        I have done HTML for many, many years, so I know it too. What is your actual issue with the subset of HTML supported by Qt, e.g. in a QTextEdit?

        You can copy the whole of the HTML content from the https://code.qt.io/cgit/qt/qtbase.git/tree/examples/widgets/richtext/textedit/example.html?h=5.14 example you refer to as a "mess", and as well as pasting it into a QTextEdit to look at it you can also save it to an .html file and open it in your web browser. Since it looks pretty similar there, you know it must be reasonably close to HTML. You can use the browser's F12 or your favorite HTML editor to examine the HTML.

        D Offline
        D Offline
        duncan98
        wrote on last edited by
        #17

        @JonB
        I want to use qtextdocument to print out the data, which will be in HTML format

        JonBJ JKSHJ 2 Replies Last reply
        0
        • D duncan98

          @JonB
          I want to use qtextdocument to print out the data, which will be in HTML format

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

          @duncan98
          What is your question? You can print from a QTextDocument. It supports precisely the HTML subset we have referenced above. If your content fits into that subset it will work, if your content goes beyond that into non-supported HTML constructs it will not (probably just ignore them). That's just how it is.

          If you want full HTML support you would need to move to using QtWebEngine. You can print from there too, which would then support full HTML. You can arrange for the content of a QTextDocument to go into a QWebEnginePage if desired. But your original QTextDocument is still liable to be limited to the Qt-supported richtext-HTML subset.

          1 Reply Last reply
          3
          • D duncan98

            @JonB
            I want to use qtextdocument to print out the data, which will be in HTML format

            JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #19

            @duncan98 said in Why the help document does not have a complete example of HTML? I think it's completely guesswork to use it. It seems that it's not completely compatible with html4:

            I want to use qtextdocument to print out the data, which will be in HTML format

            Please:

            1. Describe your requirements in more detail.
            2. Show us what you have tried and didn't work.

            If you already have another topic that describes that, give us a link to that topic.

            This topic is about the documentation. Has your question about documentation been answered? If so, close the topic.

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

            D 1 Reply Last reply
            3
            • JKSHJ JKSH

              @duncan98 said in Why the help document does not have a complete example of HTML? I think it's completely guesswork to use it. It seems that it's not completely compatible with html4:

              I want to use qtextdocument to print out the data, which will be in HTML format

              Please:

              1. Describe your requirements in more detail.
              2. Show us what you have tried and didn't work.

              If you already have another topic that describes that, give us a link to that topic.

              This topic is about the documentation. Has your question about documentation been answered? If so, close the topic.

              D Offline
              D Offline
              duncan98
              wrote on last edited by
              #20

              @JKSH
              My requirement is to print the data in the qtablewidget. Is there an easy way to do this

              mrjjM JonBJ 2 Replies Last reply
              0
              • D duncan98

                @JKSH
                My requirement is to print the data in the qtablewidget. Is there an easy way to do this

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

                Hi
                You mean like this ?
                https://forum.qt.io/topic/78143/export-a-qtablewidget-in-pdf

                1 Reply Last reply
                2
                • D duncan98

                  @JKSH
                  My requirement is to print the data in the qtablewidget. Is there an easy way to do this

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

                  @duncan98
                  Your first decision is whether you want to print as a QTableWidget, with how that appears, or whether you want to export its content to a QTextDocument and print as a generic table. I have done both.

                  D 1 Reply Last reply
                  4
                  • JonBJ JonB

                    @duncan98
                    Your first decision is whether you want to print as a QTableWidget, with how that appears, or whether you want to export its content to a QTextDocument and print as a generic table. I have done both.

                    D Offline
                    D Offline
                    duncan98
                    wrote on last edited by
                    #23

                    @JonB
                    How can qtablewidget be printed directly?

                    JonBJ 1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      duncan98
                      wrote on last edited by
                      #24
                      This post is deleted!
                      1 Reply Last reply
                      0
                      • D duncan98

                        @JonB
                        How can qtablewidget be printed directly?

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

                        @duncan98
                        What about the accepted solution in https://stackoverflow.com/questions/45467942/how-can-i-print-a-qwidget-in-qt ? The point is QWidget::render() to a painter/paint device which is the desired QPrinter. See https://doc.qt.io/qt-5/qtprintsupport-index.html#printing-widgets.

                        If you decide you want to do it by generating an HTML document into a QDocument off the QTableWidget after all, see alternatively e.g. https://stackoverflow.com/questions/56605601/using-qt5-how-can-i-print-a-qtablewidget-and-scale-a-table-to-fit-onto-one-side. I went for this approach off any QTableView/model with rows & columns myself, so it's generic, I can use stylesheets for printing, I can export to PDF/CSV/XLSX, etc. One issue about printing the QTableWidget as-is is that you get e.g. the column widths/truncation etc. you see on the screen, which may not be desirable, depending on your usage.

                        1 Reply Last reply
                        3

                        • Login

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