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 ) |
轉換純文本字符串 plain 到 HTML 格式段落,同時保留其大部分外觀。
mode 定義如何處理空白。
此函數的定義在
<QTextDocument>
頭文件。
另請參閱 QString::toHtmlEscaped () 和 mightBeRichText ().
返迴
true
若字符串
text
可能是富文本;否則返迴
false
.
該函數使用快速,因此會簡單試探。它主要校驗第一換行符之前,是否存在看起來像標記的東西。盡管對於常見情況,結果可能是正確的,但不保證。
此函數的定義在
<QTextDocument>
頭文件。