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
-
@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:
Why the help document does not have a complete example of HTML? I think it's completely guesswork to use it.
The doumentation is at https://doc.qt.io/qt-5/richtext-html-subset.html
It seems that it's not completely compatible with html4
You are right; Qt Widgets are not completely compatible with HTML4. It only supports a subset of HTML4.
If you want full HTML5 compatibility, consider the Qt WebEngine: https://doc.qt.io/qt-5/qtwebengine-index.html (Note: This is a heavyweight web engine; if you use it, be sure to subscribe to security advisories and patch your app as soon as a security patch is released)
-
@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:
This document is too simple. It doesn't even have an example. How do you use it?I just want to print out the data
The first link was a reference document that tells you all the tags that are supported.
If you want examples, search your Qt Creator IDE's Examples section. Use "rich text" as your keyword. See https://doc.qt.io/qt-5/examples-richtext.html
-
@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 need HTML examples, not rich text
The rich text examples are HTML4 examples.
-
@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:
There is no use of HTML in it
https://code.qt.io/cgit/qt/qtbase.git/tree/examples/widgets/richtext/textedit/example.html?h=5.14
-
@duncan98 I suggest you first take a look at HTML documentation: https://www.w3schools.com/html/
-
@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:
What is this mess
You claimed that the rich text examples don't use HTML.
I showed you that the Text Edit Rich Text example uses HTML.
-
@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 confusingI 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. -
@duncan98
What is your question? You can print from aQTextDocument
. 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 aQTextDocument
to go into aQWebEnginePage
if desired. But your originalQTextDocument
is still liable to be limited to the Qt-supported richtext-HTML subset. -
@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:
- Describe your requirements in more detail.
- 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.