Commit 1eb97bd5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port some qregexp code

parent dee57b7e
......@@ -22,6 +22,7 @@
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QFocusEvent>
#include <QRegularExpression>
/*=============================================================================
......@@ -150,7 +151,8 @@ void LineEdit::dropEvent(QDropEvent* e)
{
// Remove newlines from a list of email addresses, and allow an eventual mailto: scheme
const QString mailto = QStringLiteral("mailto:");
newEmails = txt.split(QRegExp(QLatin1String("[\r\n]+")), Qt::SkipEmptyParts);
static QRegularExpression regexp(QLatin1String("[\r\n]+"));
newEmails = txt.split(regexp, Qt::SkipEmptyParts);
for (QStringList::Iterator it = newEmails.begin(); it != newEmails.end(); ++it)
{
if ((*it).startsWith(mailto))
......
......@@ -19,6 +19,7 @@
#include <QApplication>
#include <QIcon>
#include <QRegularExpression>
/*=============================================================================
......@@ -709,8 +710,10 @@ QString ResourceDataModelBase::alarmTimeText(const DateTime& dateTime, char lead
// 'HH' and 'hh' provide leading zeroes; single 'H' or 'h' provide no
// leading zeroes.
int i = timeFormat.indexOf(QRegExp(QLatin1String("[hH]")));
int first = timeFormat.indexOf(QRegExp(QLatin1String("[hHmaA]")));
static const QRegularExpression hourReg(QLatin1String("[hH]"));
int i = timeFormat.indexOf(hourReg);
static const QRegularExpression hourMonthReg(QLatin1String("[hH]"));
int first = timeFormat.indexOf(hourMonthReg);
if (i >= 0 && i == first && (i == timeFormat.size() - 1 || timeFormat.at(i) != timeFormat.at(i + 1)))
{
timeFullFormat = timeFormat;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment