Change editpatientform to a only detail display widget.
This commit is contained in:
@@ -247,7 +247,6 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|||||||
dialog.setAlertMessage(QString(tr("Delete Patient \"%1\" ?")).arg(pat_name));
|
dialog.setAlertMessage(QString(tr("Delete Patient \"%1\" ?")).arg(pat_name));
|
||||||
if (dialog.exec() != QDialog::Accepted) return;
|
if (dialog.exec() != QDialog::Accepted) return;
|
||||||
// need delete clear edit panel detail
|
// need delete clear edit panel detail
|
||||||
edit_patient->setEditEnable(false);
|
|
||||||
edit_patient->clearPatientInformation();
|
edit_patient->clearPatientInformation();
|
||||||
model->setData(model->index(table->currentIndex().row(), PatientInformationEnum::Flag), 9);
|
model->setData(model->index(table->currentIndex().row(), PatientInformationEnum::Flag), 9);
|
||||||
|
|
||||||
|
|||||||
@@ -14,13 +14,6 @@ EditPatientForm::EditPatientForm(QWidget* parent) :
|
|||||||
{
|
{
|
||||||
// this->layout()->setContentsMargins(5,5,5,5);
|
// this->layout()->setContentsMargins(5,5,5,5);
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
//ui->lbl_Sex->setText(tr("Gender"));
|
|
||||||
QHBoxLayout* sexlayout = new QHBoxLayout(ui->sexpanelwidget);
|
|
||||||
sexlayout->setMargin(6);
|
|
||||||
ADD_TOOL_SIZE_BTN_TO_LAYOUT(F, ":/icons/female_d.png", 30, sexlayout);
|
|
||||||
ADD_TOOL_SIZE_BTN_TO_LAYOUT(M, ":/icons/male_d.png", 30, sexlayout);
|
|
||||||
btnF->setText(tr("Female"));
|
|
||||||
btnM->setText(tr("Male"));
|
|
||||||
|
|
||||||
ui->hideBtn->setSizePolicy(QSizePolicy::Policy::Expanding,QSizePolicy::Policy::Preferred);
|
ui->hideBtn->setSizePolicy(QSizePolicy::Policy::Expanding,QSizePolicy::Policy::Preferred);
|
||||||
ui->hideBtn->setObjectName("hideeditBtn");
|
ui->hideBtn->setObjectName("hideeditBtn");
|
||||||
@@ -31,62 +24,23 @@ EditPatientForm::EditPatientForm(QWidget* parent) :
|
|||||||
connect(ui->hideBtn,&QToolButton::clicked,[=](){
|
connect(ui->hideBtn,&QToolButton::clicked,[=](){
|
||||||
emit hideBtnClicked();
|
emit hideBtnClicked();
|
||||||
});
|
});
|
||||||
|
|
||||||
// btnFemale->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
|
||||||
// btnMale->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
|
||||||
|
|
||||||
btnF->setObjectName("sexBtn");
|
|
||||||
btnM->setObjectName("sexBtn");
|
|
||||||
//btnF->setText("Female");
|
|
||||||
//btnM->setText("Male");
|
|
||||||
ui->sexpanelwidget->setEnabled(editEnable);
|
|
||||||
btnF->setEnabled(editEnable);
|
|
||||||
btnM->setEnabled(editEnable);
|
|
||||||
btnF->setCheckable(true);
|
|
||||||
btnM->setCheckable(true);
|
|
||||||
QButtonGroup* group = new QButtonGroup(this);
|
|
||||||
group->addButton(btnF);
|
|
||||||
group->addButton(btnM);
|
|
||||||
btnF->setChecked(true);
|
|
||||||
btnFemale = btnF;
|
|
||||||
btnMale = btnM;
|
|
||||||
QHBoxLayout* layout = new QHBoxLayout(this->ui->editcmdWidget);
|
|
||||||
|
|
||||||
ADD_TOOL_BTN(Cancel, ":/icons/close_circle.png");
|
|
||||||
ADD_TOOL_BTN(Accpet, ":/icons/selected.png");
|
|
||||||
btnCancel->setText(tr("Cancel"));
|
|
||||||
btnAccpet->setText(tr("Accept"));
|
|
||||||
btnCancel->setEnabled(editEnable);
|
|
||||||
btnCancel->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
|
||||||
btnCancel->setIcon(QIcon(editEnable ? ":/icons/close_circle.png" : ":/icons/close_circle_d.png"));
|
|
||||||
btnAccpet->setEnabled(editEnable);
|
|
||||||
btnAccpet->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
|
||||||
btnAccpet->setIcon(QIcon(editEnable ? ":/icons/selected.png" : ":/icons/selected_d.png"));
|
|
||||||
btnEditAccept = btnAccpet;
|
|
||||||
btnEditCancel = btnCancel;
|
|
||||||
connect(btnEditCancel, &QToolButton::clicked, [=]() {
|
|
||||||
clearPatientInformation();
|
|
||||||
this->setEditEnable(false);
|
|
||||||
restorePatientInformation();
|
|
||||||
emit editCancel();
|
|
||||||
});
|
|
||||||
connect(btnEditAccept, &QToolButton::clicked, [=]() {
|
|
||||||
if (ui->tbx_ID->text().isEmpty())return;
|
|
||||||
if (ui->tbx_Name->text().isEmpty())return;
|
|
||||||
storePatientInformation();
|
|
||||||
bool result = true;
|
|
||||||
emit editAccept(getPatientInformation(), result);
|
|
||||||
if (result) this->setEditEnable(false);
|
|
||||||
});
|
|
||||||
ui->tbx_Dob->setDisplayFormat("yyyy/MM/dd");
|
ui->tbx_Dob->setDisplayFormat("yyyy/MM/dd");
|
||||||
|
|
||||||
|
ui->tbx_ID->setEnabled(false);
|
||||||
|
ui->tbx_ID->setObjectName("display_tbx");
|
||||||
|
ui->tbx_Dob->setEnabled(false);
|
||||||
|
ui->tbx_Dob->setObjectName("display_tbx");
|
||||||
|
ui->tbx_Name->setEnabled(false);
|
||||||
|
ui->tbx_Name->setObjectName("display_tbx");
|
||||||
|
ui->tbx_Sex->setEnabled(false);
|
||||||
|
ui->tbx_Sex->setObjectName("display_tbx");
|
||||||
|
ui->rtbx_Comment->setEnabled(false);
|
||||||
|
ui->rtbx_Comment->setObjectName("display_tbx");
|
||||||
|
|
||||||
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
|
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
|
||||||
|
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
btnF->setText(tr("Female"));
|
ui->tbx_Sex->setText(store.Sex == "F"?tr("Female"):(store.Sex=="M"?tr("Male"):tr("Other")));
|
||||||
btnM->setText(tr("Male"));
|
|
||||||
btnCancel->setText(tr("Cancel"));
|
|
||||||
btnAccpet->setText(tr("Accept"));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -105,10 +59,10 @@ void EditPatientForm::setPatientInformation(PatientInformation* information) {
|
|||||||
ui->tbx_Dob->setDate(QDate::fromString(information->BirthDate, "yyyy-MM-dd"));
|
ui->tbx_Dob->setDate(QDate::fromString(information->BirthDate, "yyyy-MM-dd"));
|
||||||
ui->tbx_Name->setText(information->Name);
|
ui->tbx_Name->setText(information->Name);
|
||||||
ui->rtbx_Comment->setText(information->Comment);
|
ui->rtbx_Comment->setText(information->Comment);
|
||||||
btnFemale->setChecked(information->Sex == "F");
|
ui->tbx_Sex->setText(information->Sex == "F"?tr("Female"):(information->Sex=="M"?tr("Male"):tr("Other")));
|
||||||
btnMale->setChecked(information->Sex != "F");
|
|
||||||
currentPatientUID = information->PatientUID;
|
currentPatientUID = information->PatientUID;
|
||||||
AddDate = information->AddDate;
|
AddDate = information->AddDate;
|
||||||
|
store.Sex = information->Sex;
|
||||||
storePatientInformation();
|
storePatientInformation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,51 +71,18 @@ void EditPatientForm::clearPatientInformation() {
|
|||||||
ui->tbx_ID->setText("");
|
ui->tbx_ID->setText("");
|
||||||
ui->tbx_Dob->setDate(QDate::currentDate());
|
ui->tbx_Dob->setDate(QDate::currentDate());
|
||||||
ui->tbx_Name->setText("");
|
ui->tbx_Name->setText("");
|
||||||
btnFemale->setChecked(true);
|
ui->tbx_Sex->setText("");
|
||||||
btnMale->setChecked(false);
|
|
||||||
ui->rtbx_Comment->setText("");
|
ui->rtbx_Comment->setText("");
|
||||||
currentPatientUID = "";
|
currentPatientUID = "";
|
||||||
AddDate = "";
|
AddDate = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditPatientForm::setEditEnable(bool enable) {
|
|
||||||
ui->tbx_ID->setEnabled(enable);
|
|
||||||
ui->tbx_Dob->setEnabled(enable);
|
|
||||||
ui->tbx_Name->setEnabled(enable);
|
|
||||||
ui->sexpanelwidget->setEnabled(enable);
|
|
||||||
btnFemale->setEnabled(enable);
|
|
||||||
btnFemale->setIcon(QIcon(enable ? ":/icons/female.png" : ":/icons/female_d.png"));
|
|
||||||
btnMale->setEnabled(enable);
|
|
||||||
btnMale->setIcon(QIcon(enable ? ":/icons/male.png" : ":/icons/male_d.png"));
|
|
||||||
ui->rtbx_Comment->setEnabled(enable);
|
|
||||||
btnEditAccept->setEnabled(enable);
|
|
||||||
btnEditCancel->setEnabled(enable);
|
|
||||||
btnEditCancel->setIcon(QIcon(enable ? ":/icons/close_circle.png" : ":/icons/close_circle_d.png"));
|
|
||||||
btnEditAccept->setIcon(QIcon(enable ? ":/icons/selected.png" : ":/icons/selected_d.png"));
|
|
||||||
editEnable = enable;
|
|
||||||
// ui->->setEnabled(enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditPatientForm::storePatientInformation() {
|
void EditPatientForm::storePatientInformation() {
|
||||||
store.PatientUID = currentPatientUID;
|
store.PatientUID = currentPatientUID;
|
||||||
store.AddDate = AddDate;
|
store.AddDate = AddDate;
|
||||||
store.ID = ui->tbx_ID->text();
|
store.ID = ui->tbx_ID->text();
|
||||||
store.BirthDate = ui->tbx_Dob->date().toString("yyyy-MM-dd");
|
store.BirthDate = ui->tbx_Dob->date().toString("yyyy-MM-dd");
|
||||||
store.Name = ui->tbx_Name->text();
|
store.Name = ui->tbx_Name->text();
|
||||||
store.Sex = btnFemale->isChecked() ? "F" : "M";
|
|
||||||
store.Comment = ui->rtbx_Comment->toPlainText();
|
store.Comment = ui->rtbx_Comment->toPlainText();
|
||||||
qDebug() << store.PatientUID << "," << store.ID << "," << store.BirthDate << "," << store.Name << "," << store.Sex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditPatientForm::restorePatientInformation() {
|
|
||||||
currentPatientUID = store.PatientUID;
|
|
||||||
AddDate = store.AddDate;
|
|
||||||
ui->tbx_ID->setText(store.ID);
|
|
||||||
ui->tbx_Dob->setDate(QDate::fromString(store.BirthDate, "yyyy-MM-dd"));
|
|
||||||
ui->tbx_Name->setText(store.Name);
|
|
||||||
ui->rtbx_Comment->setText(store.Comment);
|
|
||||||
btnFemale->setChecked(store.Sex == "F");
|
|
||||||
btnMale->setChecked(store.Sex != "F");
|
|
||||||
// ui->cb_Sex->setCurrentText(store.Sex=="F"?"Female":(store.Name=="M"?"Male":"Other"));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ enum PatientInformationEnum{
|
|||||||
#undef ADD_PATIENT_PROPERTY
|
#undef ADD_PATIENT_PROPERTY
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief this class was designed to be a edit form,
|
||||||
|
* but now has been change to a detail display class.
|
||||||
|
*/
|
||||||
class PatientInformation:public QObject{
|
class PatientInformation:public QObject{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@@ -65,9 +69,8 @@ public:
|
|||||||
}
|
}
|
||||||
void clearPatientInformation();
|
void clearPatientInformation();
|
||||||
void storePatientInformation();
|
void storePatientInformation();
|
||||||
void restorePatientInformation();
|
|
||||||
void setEditEnable(bool enable);
|
signals:
|
||||||
signals:
|
|
||||||
void editAccept(PatientInformation * detail,bool & accept);
|
void editAccept(PatientInformation * detail,bool & accept);
|
||||||
void editCancel();
|
void editCancel();
|
||||||
signals:
|
signals:
|
||||||
@@ -77,11 +80,6 @@ private:
|
|||||||
QString currentPatientUID;
|
QString currentPatientUID;
|
||||||
QString AddDate;
|
QString AddDate;
|
||||||
PatientInformation store;
|
PatientInformation store;
|
||||||
bool editEnable=false;
|
|
||||||
QToolButton* btnEditAccept;
|
|
||||||
QToolButton* btnEditCancel;
|
|
||||||
QToolButton* btnFemale;
|
|
||||||
QToolButton* btnMale;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EDITPATIENTFORM_H
|
#endif // EDITPATIENTFORM_H
|
||||||
|
|||||||
@@ -13,22 +13,7 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="hideBtn">
|
<widget class="QToolButton" name="hideBtn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -36,20 +21,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="lbl_ID">
|
<widget class="QLabel" name="lbl_ID">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -60,7 +31,10 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="tbx_ID">
|
<widget class="QLineEdit" name="tbx_ID">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -74,7 +48,10 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="tbx_Name">
|
<widget class="QLineEdit" name="tbx_Name">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -86,7 +63,14 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="sexpanelwidget" native="true"/>
|
<widget class="QLineEdit" name="tbx_Sex">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="lbl_DOB">
|
<widget class="QLabel" name="lbl_DOB">
|
||||||
@@ -98,7 +82,10 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QDateEdit" name="tbx_Dob">
|
<widget class="QDateEdit" name="tbx_Dob">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="buttonSymbols">
|
<property name="buttonSymbols">
|
||||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||||
@@ -136,7 +123,10 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTextEdit" name="rtbx_Comment">
|
<widget class="QTextEdit" name="rtbx_Comment">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -144,8 +134,6 @@
|
|||||||
<widget class="QWidget" name="editcmdWidget" native="true"/>
|
<widget class="QWidget" name="editcmdWidget" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user