Replace QRegExp with QRegularExpression

Revise `static` keyword usage, static is added to frequently used
instances.
This commit is contained in:
Chocobo1 2018-05-24 23:41:03 +08:00
parent c22e6b4502
commit 09f759355f
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
14 changed files with 72 additions and 63 deletions

View file

@ -36,6 +36,7 @@
#include <QDragMoveEvent>
#include <QMenu>
#include <QMessageBox>
#include <QRegularExpression>
#include <QStandardItemModel>
#include <QString>
@ -461,10 +462,10 @@ void RSSWidget::handleCurrentArticleItemChanged(QListWidgetItem *currentItem, QL
}
else {
QString description = article->description();
QRegExp rx;
QRegularExpression rx;
// If description is plain text, replace BBCode tags with HTML and wrap everything in <pre></pre> so it looks nice
rx.setMinimal(true);
rx.setCaseSensitivity(Qt::CaseInsensitive);
rx.setPatternOptions(QRegularExpression::InvertedGreedinessOption
| QRegularExpression::CaseInsensitiveOption);
rx.setPattern("\\[img\\](.+)\\[/img\\]");
description = description.replace(rx, "<img src=\"\\1\">");