mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Text: toHtmlChars
This commit is contained in:
parent
3190530686
commit
7a4af239b0
|
@ -286,3 +286,14 @@ void Text::detectAnchors()
|
|||
offset += htmledUrl.length();
|
||||
}
|
||||
}
|
||||
|
||||
QString Text::toHtmlChars(const QString &str)
|
||||
{
|
||||
static QList<QPair<QString, QString>> replaceList = {{"&","&"}, {">",">"}, {"<","<"}};
|
||||
QString res = str;
|
||||
|
||||
for (auto &it : replaceList)
|
||||
res = res.replace(it.first,it.second);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ protected:
|
|||
int cursorFromPos(QPointF scenePos) const;
|
||||
|
||||
void detectAnchors();
|
||||
QString toHtmlChars(const QString& str);
|
||||
|
||||
private:
|
||||
CustomTextDocument* doc = nullptr;
|
||||
|
|
Loading…
Reference in New Issue
Block a user