fix: Fix setValidator memory leak.
This commit is contained in:
@@ -49,7 +49,7 @@ AccountFormDialog::AccountFormDialog(QWidget* parent, AccountEditMode mode, Qt::
|
||||
&AccountFormDialog::changeSelfPassword : &AccountFormDialog::resetUserPassword);
|
||||
}
|
||||
|
||||
mLeUserName->setValidator(new QRegExpValidator(QRegExp("^[A-Za-z0-9\u4e00-\u9fa5]+$")));
|
||||
mLeUserName->setValidator(new QRegExpValidator(QRegExp("^[A-Za-z0-9\u4e00-\u9fa5]+$"), mLeUserName));
|
||||
connect(mLeComment, &QLineEdit::textChanged, [=](const QString& text) {
|
||||
mCommentChanged = true;
|
||||
});
|
||||
|
||||
@@ -48,7 +48,7 @@ EditPatientDialog::EditPatientDialog(QWidget* parent, Qt::WindowFlags f) : GUIFo
|
||||
QLabel* lbl_id = new QLabel(this);
|
||||
lbl_id->setText(tr("ID ") + QString("<font color='#930000'>*</font>"));
|
||||
le_id = new ULineEdit(this);
|
||||
le_id->setValidator(new QRegExpValidator(QRegExp("[a-zA-z0-9]+$")));
|
||||
le_id->setValidator(new QRegExpValidator(QRegExp("[a-zA-z0-9]+$"), le_id));
|
||||
layout->addWidget(lbl_id);
|
||||
layout->addWidget(le_id);
|
||||
QLabel* lbl_endline1 = new QLabel(this);
|
||||
@@ -59,7 +59,7 @@ EditPatientDialog::EditPatientDialog(QWidget* parent, Qt::WindowFlags f) : GUIFo
|
||||
QLabel* lbl_AccessionNumber = new QLabel(this);
|
||||
lbl_AccessionNumber->setText(tr("Accession Number"));
|
||||
mAccessionNumber = new ULineEdit(this);
|
||||
mAccessionNumber->setValidator(new QRegExpValidator(QRegExp("[a-zA-z0-9]+$")));
|
||||
mAccessionNumber->setValidator(new QRegExpValidator(QRegExp("[a-zA-z0-9]+$"), mAccessionNumber));
|
||||
|
||||
layout->addWidget(lbl_AccessionNumber);
|
||||
layout->addWidget(mAccessionNumber);
|
||||
@@ -71,7 +71,7 @@ EditPatientDialog::EditPatientDialog(QWidget* parent, Qt::WindowFlags f) : GUIFo
|
||||
QLabel* lbl_name = new QLabel(this);
|
||||
lbl_name->setText(tr("Name") + QString("<font color='#930000'>*</font>"));
|
||||
le_name = new ULineEdit(this);
|
||||
le_name->setValidator(new QRegExpValidator(QRegExp("^[A-Za-z0-9\u4e00-\u9fa5]+$")));
|
||||
le_name->setValidator(new QRegExpValidator(QRegExp("^[A-Za-z0-9\u4e00-\u9fa5]+$"), le_name));
|
||||
layout->addWidget(lbl_name);
|
||||
layout->addWidget(le_name);
|
||||
QLabel* lbl_endline2 = new QLabel(this);
|
||||
@@ -180,13 +180,13 @@ bool EditPatientDialog::updateReferenceData()
|
||||
PatientInformation* inf = getPatientInformation();
|
||||
if (le_id->text().isEmpty())
|
||||
{
|
||||
showErrorMessage("ID can't be empty!");
|
||||
showErrorMessage(tr("ID can't be empty!"));
|
||||
return false;
|
||||
}
|
||||
inf->ID = le_id->text().trimmed();
|
||||
if (le_name->text().isEmpty())
|
||||
{
|
||||
showErrorMessage("Patient Name can't be empty!");
|
||||
showErrorMessage(tr("Patient Name can't be empty!"));
|
||||
return false;
|
||||
}
|
||||
inf->AccessionNumber = mAccessionNumber->text().trimmed();
|
||||
@@ -198,7 +198,7 @@ bool EditPatientDialog::updateReferenceData()
|
||||
int ref_rowid = queryValue(model, 1, inf->ID, 2, inf->AccessionNumber);
|
||||
if (ref_rowid >= 0)
|
||||
{
|
||||
showErrorMessage("The ID and Accession number is already existed!");
|
||||
showErrorMessage(tr("The ID and Accession number is already existed!"));
|
||||
return false;
|
||||
}
|
||||
inf->PatientUID = QUuid::createUuid().toString();
|
||||
|
||||
Reference in New Issue
Block a user