Select form state change logic
This commit is contained in:
@@ -123,10 +123,15 @@ SelectFormWidget::SelectFormWidget(QWidget *parent) :
|
||||
connect(btnAdd, &QToolButton::clicked,[=](){
|
||||
edit_patient->clearPatientInformation();
|
||||
edit_patient->setEditEnable(true);
|
||||
btnSelect->setEnabled(false);
|
||||
});
|
||||
connect(btnEdit, &QToolButton::clicked,[=](){
|
||||
table->clicked(table->currentIndex());
|
||||
edit_patient->setEditEnable(true);
|
||||
btnSelect->setEnabled(false);
|
||||
});
|
||||
connect(edit_patient, &EditPatientForm::editCancel,[=](){
|
||||
btnSelect->setEnabled(true);
|
||||
});
|
||||
connect(edit_patient, &EditPatientForm::editAccept,[=](PatientInformation* inf){
|
||||
int selectedRow = currentRow;
|
||||
@@ -148,11 +153,13 @@ SelectFormWidget::SelectFormWidget(QWidget *parent) :
|
||||
else{
|
||||
//TODO:add some error handle logic
|
||||
}
|
||||
btnSelect->setEnabled(true);
|
||||
});
|
||||
|
||||
connect(btnDelete, &QToolButton::clicked,[=](){
|
||||
if (currentRow<0)return;
|
||||
model->removeRow(currentRow);
|
||||
model->setData(model->index(currentRow,PatientInformationEnum::Flag),9);
|
||||
// model->removeRow(currentRow);
|
||||
if (model->submitAll())
|
||||
{
|
||||
model->select();
|
||||
@@ -160,12 +167,20 @@ SelectFormWidget::SelectFormWidget(QWidget *parent) :
|
||||
{
|
||||
table->selectRow(0);
|
||||
model->selectRow(0);
|
||||
PatientInformation pat;
|
||||
#define ADD_PATIENT_PROPERTY(val)\
|
||||
pat. val = model->data(model->index(0,PatientInformationEnum:: val)).toString();
|
||||
EDIT_PATIENT()
|
||||
#undef ADD_PATIENT_PROPERTY
|
||||
edit_patient->setPatientInformation(&pat);
|
||||
} else{
|
||||
currentRow=-1;
|
||||
}
|
||||
} else{
|
||||
//TODO:error handle
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
connect(btnSelect, &QToolButton::clicked,[=](){
|
||||
|
||||
Reference in New Issue
Block a user