Skip to content

Commit

Permalink
Replace QRegExpValidator by QRegularExpressionValidator
Browse files Browse the repository at this point in the history
And QRegExp by QRegularExpression, they were deprecated.
  • Loading branch information
amtriathlon committed Jan 16, 2024
1 parent e95608e commit c553de5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/Cloud/CloudDBChart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <QJsonArray>
#include <QXmlInputSource>
#include <QXmlSimpleReader>
#include <QRegularExpressionValidator>

CloudDBChartClient::CloudDBChartClient()
{
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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

Expand Down
9 changes: 5 additions & 4 deletions src/Cloud/CloudDBUserMetric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <QJsonArray>
#include <QXmlInputSource>
#include <QXmlSimpleReader>
#include <QRegularExpressionValidator>

CloudDBUserMetricClient::CloudDBUserMetricClient()
{
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit c553de5

Please sign in to comment.