Core: replace QRegExp with QRegularExpression

This commit is contained in:
wmayer
2022-10-06 13:54:20 +02:00
parent 8b7c61277a
commit 807fa281a8
11 changed files with 99 additions and 62 deletions

View File

@@ -23,6 +23,8 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <sstream>
# include <QRegularExpression>
# include <QRegularExpressionMatch>
#endif
#include "Command.h"
@@ -97,15 +99,14 @@ PyObject* CommandPy::listByShortcut(PyObject *args)
if (action) {
QString spc = QString::fromLatin1(" ");
if (Base::asBoolean(bIsRegularExp)) {
QRegExp re = QRegExp(QString::fromLatin1(shortcut_to_find));
re.setCaseSensitivity(Qt::CaseInsensitive);
QRegularExpression re(QString::fromLatin1(shortcut_to_find), QRegularExpression::CaseInsensitiveOption);
if (!re.isValid()) {
std::stringstream str;
str << "Invalid regular expression:" << ' ' << shortcut_to_find;
throw Py::RuntimeError(str.str());
}
if (re.indexIn(action->shortcut().toString().remove(spc).toUpper()) != -1) {
if (re.match(action->shortcut().toString().remove(spc).toUpper()).hasMatch()) {
matches.emplace_back(c->getName());
}
}