Qt Namespace
Qt 命名空间包括模块 QtGui 中的以下元素。整个命名空间在 QtCore 模块中有详细说明 here.
函数
QString | convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode = WhiteSpacePre) |
bool | mightBeRichText(QAnyStringView text) |
函数文档
QString Qt::convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode = WhiteSpacePre)
将纯文本字符串plain 转换为 HTML 格式的段落,同时保留其大部分外观。
mode 定义如何处理空白。
该函数在<QTextDocument>
头文件中定义。
另请参阅 QString::toHtmlEscaped() 和mightBeRichText()。
bool Qt::mightBeRichText(QAnyStringView text)
如果text 字符串可能是富文本,则返回true
;否则返回false
。
该函数使用快速且简单的启发式方法。它主要检查第一个换行符前是否有类似标记的内容。虽然在常见情况下结果可能是正确的,但并不能保证。
该函数定义在<QTextDocument>
头文件中。
注意: 在 6.7 之前的 Qt XML 版本中,该函数仅使用QString 。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.