QML 中的 Qt5 语法高亮 [英] Qt5 Syntax Highlighting in QML

查看:51
本文介绍了QML 中的 Qt5 语法高亮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作 QtQuick 2.0 演示文稿,我想嵌入一些代码示例.是否可以轻松创建语法高亮 qml 元素.

I am working on a QtQuick 2.0 presentation and I would like to embed some code samples. is it possible easily to create a syntax highlighting qml element.

你能告诉我如何实现它的示例技术和想法吗.

Can you give me example technologies and ideas on how to achieve it.

谢谢

推荐答案

Qt Quick 的 TextEdit 项公开了 textDocument 属性,类型为 QQuickTextDocument.这是显式公开的,因此您可以直接在文档中使用 QSyntaxHighlighter.

Qt Quick's TextEdit item exposes a textDocument property, of type QQuickTextDocument. This is explicitly exposed so you can use QSyntaxHighlighter directly with the document.

Qt 5.3 的 QtQuick textEdit 文档

这篇关于QML 中的 Qt5 语法高亮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆