//this makes the adddialog SLOT to instantiate an "Add" dialog
void mainwindow::adddialogslot() {
adddialog *add = new adddialog;
add->show();
if (add->Accepted) {
model->insertRecord(-1,add->record);
}
}
//this makes the adddialog SLOT to instantiate an "Add" dialog
void mainwindow::adddialogslot() {
adddialog *add = new adddialog;
add->show();
if (add->Accepted) {
model->insertRecord(-1,add->record);
}
}
To copy to clipboard, switch view to plain text mode
void adddialog::allowinput() {
if (lineEdit_name->text().isEmpty() || lineEdit_surname->text().isEmpty()
|| lineEdit_phone->text().isEmpty() || lineEdit_phone1->text().isEmpty()
|| lineEdit_phone2->text().isEmpty() || lineEdit_phone3->text().isEmpty()
|| lineEdit_address->text().isEmpty() || lineEdit_year->text().isEmpty()
|| lineEdit_insurance->text().isEmpty() || lineEdit_HS->text().isEmpty()
|| lineEdit_diseases->text().isEmpty() || lineEdit_treat->text().isEmpty()
|| lineEdit_comp->text().isEmpty() || comboBox_day->currentText().isEmpty()
|| comboBox_month->currentText().isEmpty() || !(radioButton_M->isChecked() || radioButton_F->isChecked()) ) {
QMessageBox::information(this, tr
("Add Patient"), tr
("Please fill in all of the required fields"));
}
else {
record.setValue("name", lineEdit_name->text());
record.setValue("surname", lineEdit_surname->text());
if (radioButton_M->isChecked()) {
record.setValue("gender", "M");
}
else {
record.setValue("gender", "F");
}
record.setValue("birth date", comboBox_day->currentText() + "/" + comboBox_month->currentText() +"/"+ lineEdit_year->text());
record.setValue("address", lineEdit_address->text());
record.setValue("phone number", lineEdit_phone->text() + lineEdit_phone1->text() + lineEdit_phone2->text() + lineEdit_phone3->text());
record.setValue("insurance number", lineEdit_insurance->text());
record.setValue("health system", lineEdit_HS->text());
record.setValue("diseases", lineEdit_diseases->text());
record.setValue("treatments", lineEdit_treat->text());
record.setValue("complications", lineEdit_comp->text());
}
}
void adddialog::allowinput() {
if (lineEdit_name->text().isEmpty() || lineEdit_surname->text().isEmpty()
|| lineEdit_phone->text().isEmpty() || lineEdit_phone1->text().isEmpty()
|| lineEdit_phone2->text().isEmpty() || lineEdit_phone3->text().isEmpty()
|| lineEdit_address->text().isEmpty() || lineEdit_year->text().isEmpty()
|| lineEdit_insurance->text().isEmpty() || lineEdit_HS->text().isEmpty()
|| lineEdit_diseases->text().isEmpty() || lineEdit_treat->text().isEmpty()
|| lineEdit_comp->text().isEmpty() || comboBox_day->currentText().isEmpty()
|| comboBox_month->currentText().isEmpty() || !(radioButton_M->isChecked() || radioButton_F->isChecked()) ) {
QMessageBox::information(this, tr("Add Patient"), tr("Please fill in all of the required fields"));
}
else {
record.setValue("name", lineEdit_name->text());
record.setValue("surname", lineEdit_surname->text());
if (radioButton_M->isChecked()) {
record.setValue("gender", "M");
}
else {
record.setValue("gender", "F");
}
record.setValue("birth date", comboBox_day->currentText() + "/" + comboBox_month->currentText() +"/"+ lineEdit_year->text());
record.setValue("address", lineEdit_address->text());
record.setValue("phone number", lineEdit_phone->text() + lineEdit_phone1->text() + lineEdit_phone2->text() + lineEdit_phone3->text());
record.setValue("insurance number", lineEdit_insurance->text());
record.setValue("health system", lineEdit_HS->text());
record.setValue("diseases", lineEdit_diseases->text());
record.setValue("treatments", lineEdit_treat->text());
record.setValue("complications", lineEdit_comp->text());
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks