Displaying (rendering) HTML from a string in QT

妖精的绣舞 提交于 2021-01-26 18:00:41

问题


I have html in a QString, what widget can I use to display it? (QWebView is not necessary as I dont access Internet)


回答1:


QWebViews setHtml():

The QWebView class provides a widget that is used to view and edit web documents.

In Qt QWebView is the widget that renders pages for you - if you don't need the networking features it provides, simply don't use them.




回答2:


Depending on what HTML tags you are using, you might be able to get away with a QTextEdit. It has support for most of HTML, including tables and images. Take a look at the docs and see if it fits your particular needs.

If you need something more advanced, then you will have to use the widgets in QtWebKit.



来源:https://stackoverflow.com/questions/2709487/displaying-rendering-html-from-a-string-in-qt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!