Replace QRegExpValidator by QRegularExpressionValidator

And QRegExp by QRegularExpression, they were deprecated.
This commit is contained in:
Alejandro Martinez
2024-01-16 14:56:01 -03:00
parent e95608e4bc
commit c553de5216
2 changed files with 10 additions and 8 deletions

View File

@@ -42,6 +42,7 @@
#include <QJsonArray>
#include <QXmlInputSource>
#include <QXmlSimpleReader>
#include <QRegularExpressionValidator>
CloudDBChartClient::CloudDBChartClient()
{
@@ -1236,8 +1237,8 @@ CloudDBChartObjectDialog::CloudDBChartObjectDialog(ChartAPIv1 data, QString athl
name->setText(nameDefault);
nameOk = false;
}
QRegExp name_rx("^.{5,50}$");
QValidator *name_validator = new QRegExpValidator(name_rx, this);
QRegularExpression name_rx("^.{5,50}$");
QValidator *name_validator = new QRegularExpressionValidator(name_rx, this);
name->setValidator(name_validator);
QLabel* sportLabel = new QLabel(tr("Sport"));
@@ -1282,8 +1283,8 @@ CloudDBChartObjectDialog::CloudDBChartObjectDialog(ChartAPIv1 data, QString athl
email->setText(appsettings->cvalue(athlete, GC_CLOUDDB_EMAIL, "").toString());
}
// regexp: simple e-mail validation / also allow long domain types & subdomains
QRegExp email_rx("^.+@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,10}$");
QValidator *email_validator = new QRegExpValidator(email_rx, this);
QRegularExpression email_rx("^.+@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,10}$");
QValidator *email_validator = new QRegularExpressionValidator(email_rx, this);
email->setValidator(email_validator);
emailOk = !email->text().isEmpty(); // email from properties is ok when loaded

View File

@@ -35,6 +35,7 @@
#include <QJsonArray>
#include <QXmlInputSource>
#include <QXmlSimpleReader>
#include <QRegularExpressionValidator>
CloudDBUserMetricClient::CloudDBUserMetricClient()
{
@@ -1035,8 +1036,8 @@ CloudDBUserMetricObjectDialog::CloudDBUserMetricObjectDialog(UserMetricAPIv1 dat
name->setText(data.Header.Name);
nameOk = true; // no need to re-check
}
QRegExp name_rx("^.{5,50}$");
QValidator *name_validator = new QRegExpValidator(name_rx, this);
QRegularExpression name_rx("^.{5,50}$");
QValidator *name_validator = new QRegularExpressionValidator(name_rx, this);
name->setValidator(name_validator);
QLabel* langLabel = new QLabel(tr("Language"));
@@ -1070,8 +1071,8 @@ CloudDBUserMetricObjectDialog::CloudDBUserMetricObjectDialog(UserMetricAPIv1 dat
email->setText(appsettings->cvalue(athlete, GC_CLOUDDB_EMAIL, "").toString());
}
// regexp: simple e-mail validation / also allow long domain types & subdomains
QRegExp email_rx("^.+@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,10}$");
QValidator *email_validator = new QRegExpValidator(email_rx, this);
QRegularExpression email_rx("^.+@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,10}$");
QValidator *email_validator = new QRegularExpressionValidator(email_rx, this);
email->setValidator(email_validator);
emailOk = !email->text().isEmpty(); // email from properties is ok when loaded