Qt4(哪个)小部件中的 HTML 和 CSS?

发布于 2024-08-05 13:39:36 字数 439 浏览 2 评论 0原文

有人可以告诉我在 Qt gui 中哪里可以使用 HTML 吗? 哪些小部件支持 HTML?

或者更具体地说:为什么 HTML 在 QTreeWidgetItem 和 QTreeListItem 中不起作用?

我试图将 QTreeWidgetItem 中的一些文本设置为斜体或不同的颜色,但我无法使用 HTML 来实现,它根本不被解释,我只是在树项中看到 HTML 代码。

在 QLabel HTML 中工作正常...

我做了一些研究和文档: http ://qt.nokia.com/doc/4.5/richtext-html-subset.html 说 QTreeWidgetItem 也应该支持......

Can somebody tell me where in Qt gui can I use HTML?
Which widgets do support HTML?

Or more specific: why HTML doesn't work in QTreeWidgetItem and QTreeListItem?

I'm trying to make some of the text in QTreeWidgetItem italic or different colour and I can't do it with HTML, it is not interpreted at all, I just see HTML code in tree items.

In QLabel HTML works fine...

I did some research and documentation: http://qt.nokia.com/doc/4.5/richtext-html-subset.html says that QTreeWidgetItem should support that too...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

零度° 2024-08-12 13:39:37

好的,经过一些研究,我找到了一种在 items-widgets 中查看 HTML 的方法 - 您必须向其中添加自定义委托(并处理该委托中的 HTML)。

在《使用 Python 和 Qt 进行快速 GUI 编程》一书中找到了它:-)

OK, after some research I've found a way to see HTML in items-widgets - you have to add custom delegate to it (and handle the HTML in that delegate).

Found it in "Rapid GUI Programming with Python and Qt" book :-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文