New UI for sex choose
This commit is contained in:
@@ -29,6 +29,11 @@ SelectFormWidget::SelectFormWidget(QWidget *parent) :
|
||||
"QWidget#edit_patient{min-width:300px;max-width:300px;}"
|
||||
"QTableWidget{border:none}"
|
||||
"QTableView{alternate-background-color: #595959;selection-color:white;selection-background-color:#0078d8}"
|
||||
"QToolButton#sexBtn{min-width:120px;max-width:120px;font-size:20px;padding:2px;}"
|
||||
"QToolButton#sexBtn:disabled{color:silver}"
|
||||
"QWidget#sexpanelwidget{border:1px solid silver;}"
|
||||
"QWidget#sexpanelwidget:enabled{background-color: #515151;}"
|
||||
"QToolButton#sexBtn:checked{border:2px solid darkorange;padding:0px;}"
|
||||
;
|
||||
|
||||
this->setStyleSheet(this->styleSheet().append(style));
|
||||
@@ -89,11 +94,12 @@ SelectFormWidget::SelectFormWidget(QWidget *parent) :
|
||||
connect(table,&QTableView::clicked,[=](const QModelIndex & modelIndex){
|
||||
if (currentRow!=modelIndex.row())
|
||||
{
|
||||
currentRow=modelIndex.row();
|
||||
PatientInformation pat;
|
||||
#define ADD_PATIENT_PROPERTY(val)\
|
||||
#define ADD_PATIENT_PROPERTY(val)\
|
||||
pat. val = model->data(model->index(modelIndex.row(),PatientInformationEnum:: val)).toString();
|
||||
EDIT_PATIENT()
|
||||
#undef ADD_PATIENT_PROPERTY
|
||||
#undef ADD_PATIENT_PROPERTY
|
||||
edit_patient->setPatientInformation(&pat);
|
||||
}
|
||||
});
|
||||
@@ -107,38 +113,24 @@ SelectFormWidget::SelectFormWidget(QWidget *parent) :
|
||||
edit_patient->setEditEnable(true);
|
||||
});
|
||||
connect(edit_patient, &EditPatientForm::editAccept,[=](PatientInformation* inf){
|
||||
|
||||
// QSqlRecord record = inf->PatientUID.isEmpty()?model->record():model->record(currentRow);
|
||||
int rowCount = model->rowCount();
|
||||
|
||||
bool isAdd = false;
|
||||
int selectedRow = currentRow;
|
||||
if (inf->PatientUID.isEmpty()) {
|
||||
isAdd = true;
|
||||
selectedRow = model->rowCount();
|
||||
inf->PatientUID = QUuid::createUuid().toString();
|
||||
printf(inf->PatientUID.toStdString().data());
|
||||
model->insertRow(rowCount);
|
||||
model->insertRow(selectedRow);
|
||||
}
|
||||
#define ADD_PATIENT_PROPERTY(val)\
|
||||
model->setData(model->index(rowCount,PatientInformationEnum:: val),inf-> val);
|
||||
// record.setValue(PatientInformationEnum:: val, inf-> val);
|
||||
model->setData(model->index(selectedRow,PatientInformationEnum:: val),inf-> val);
|
||||
EDIT_PATIENT()
|
||||
#undef ADD_PATIENT_PROPERTY
|
||||
// model->setData(model->index(rowCount,PatientInformationEnum::BirthDate), QDate::fromString(inf->BirthDate,"yyyy/MM/dd"));
|
||||
// record.setValue(PatientInformationEnum::BirthDate, QDate::fromString(inf->BirthDate,"yyyy/MM/dd"));
|
||||
// if (isAdd)
|
||||
// {
|
||||
// model->insertRecord(1,record);
|
||||
// } else{
|
||||
// model->setRecord(currentRow,record);
|
||||
// }
|
||||
// model->database().transaction();
|
||||
if (model->submitAll())
|
||||
{
|
||||
// model->database().commit();
|
||||
table->selectRow(selectedRow);
|
||||
}
|
||||
else{
|
||||
//TODO:add some error handle logic
|
||||
}
|
||||
// else{
|
||||
// model->database().rollback();
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user