Qt 名称空间

The Qt namespace includes the following elements from module QtGui. The full namespace is documented in module QtCore 这里。

qmake: QT += gui

函数

QString convertFromPlainText (const QString & plain , Qt::WhiteSpaceMode mode = WhiteSpacePre)
bool mightBeRichText (const QString & text )

函数文档编制

QString Qt:: convertFromPlainText (const QString & plain , Qt::WhiteSpaceMode mode = WhiteSpacePre)

转换纯文本字符串 plain 到 HTML 格式段落,同时保留其大部分外观。

mode 定义如何处理空白。

此函数的定义在 <QTextDocument> 头文件。

另请参阅 QString::toHtmlEscaped () 和 mightBeRichText ().

bool Qt:: mightBeRichText (const QString & text )

返回 true 若字符串 text 可能是富文本;否则返回 false .

该函数使用快速,因此会简单试探。它主要校验第一换行符之前,是否存在看起来像标记的东西。尽管对于常见情况,结果可能是正确的,但不保证。

此函数的定义在 <QTextDocument> 头文件。