Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 qt 中制作了一个文本编辑器,它用 html 替换单词(为 html 标签着色),但我无法更改 html 标签的颜色
string.replace("<home>","<lo style='color:#0066ff;'><home></lo>");
它适用于文字,但是当我使用 html 标签时,它什么也没做我不想突出显示我想用 css 更改颜色#
我该如何解决?
您正在尝试显示 html 标签,使用 html 突出显示,但 qt 的 html 解析器将隐藏所有 html 标签。为了显示它们,您应该将 all 替换<为<并且 all>替换为>。
<
<
>
>