Refactor TopBarWidget & SelectFormWidget.(clean and rename member)
This commit is contained in:
@@ -14,7 +14,7 @@ PatientDetailForm::PatientDetailForm(QWidget* parent) :
|
||||
{
|
||||
mUI->setupUi(this);
|
||||
mUI->hideBtn->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred);
|
||||
mUI->hideBtn->setObjectName("hideeditBtn");
|
||||
mUI->hideBtn->setObjectName("btnHidePanel");
|
||||
mUI->hideBtn->setText(tr(" Hide Panel"));
|
||||
connect(mUI->hideBtn, &QToolButton::clicked, [=](){
|
||||
emit hideBtnClicked();
|
||||
|
||||
@@ -30,7 +30,7 @@ SelectFormWidget::SelectFormWidget(QWidget* parent)
|
||||
, mBtnSelect(new QToolButton(this))
|
||||
, mPatTable(new SlideTableView(this))
|
||||
, mModel(nullptr)
|
||||
, mEditPatForm(new PatientDetailForm(this))
|
||||
, patientDetailForm(new PatientDetailForm(this))
|
||||
{
|
||||
//init command bar
|
||||
auto layout = new QHBoxLayout();
|
||||
@@ -51,7 +51,7 @@ SelectFormWidget::SelectFormWidget(QWidget* parent)
|
||||
if (mModel->rowCount() > 0)
|
||||
{
|
||||
mPatTable->selectRow(0);
|
||||
setPatientDetail(mPatTable, mModel, mEditPatForm);
|
||||
setPatientDetail(mPatTable, mModel, patientDetailForm);
|
||||
}
|
||||
// event ResponsePreview slot
|
||||
connect(EventCenter::Default(), &EventCenter::ResponsePreview, [=](QObject* sender, QObject* data) {
|
||||
@@ -122,7 +122,7 @@ void SelectFormWidget::editPatient() {
|
||||
dialog.clearPatientInformation();
|
||||
}
|
||||
else{
|
||||
dialog.setPatientInformation(mEditPatForm->getPatientInformation());
|
||||
dialog.setPatientInformation(patientDetailForm->getPatientInformation());
|
||||
}
|
||||
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
@@ -135,7 +135,7 @@ void SelectFormWidget::editPatient() {
|
||||
}
|
||||
else{
|
||||
mPatTable->clicked(mPatTable->currentIndex());
|
||||
setPatientDetail(mPatTable, mModel, mEditPatForm);
|
||||
setPatientDetail(mPatTable, mModel, patientDetailForm);
|
||||
}
|
||||
LOG_USER_OPERATION(AddPatient)
|
||||
mBtnSelect->setEnabled(true);
|
||||
@@ -162,7 +162,7 @@ void SelectFormWidget::delPatient() {
|
||||
dialog.setAlertMessage(QString(tr("Delete Patient \"%1\" ?")).arg(pat_name));
|
||||
if (dialog.exec() != QDialog::Accepted) return;
|
||||
// need delete clear edit panel detail
|
||||
mEditPatForm->clearPatientInformation();
|
||||
patientDetailForm->clearPatientInformation();
|
||||
mModel->setData(mModel->index(mPatTable->currentIndex().row(), Flag), 9);
|
||||
|
||||
if (mModel->submitAll()) {
|
||||
@@ -170,7 +170,7 @@ void SelectFormWidget::delPatient() {
|
||||
if (mModel->rowCount() > 0) {
|
||||
mPatTable->selectRow(0);
|
||||
mModel->selectRow(0);
|
||||
setPatientDetail(mPatTable, mModel, mEditPatForm);
|
||||
setPatientDetail(mPatTable, mModel, patientDetailForm);
|
||||
LOG_USER_OPERATION(DeletePatient)
|
||||
}
|
||||
} else {
|
||||
@@ -184,17 +184,17 @@ void SelectFormWidget::delPatient() {
|
||||
}
|
||||
|
||||
void SelectFormWidget::selectPatient() {
|
||||
EventCenter::Default()->triggerEvent(PatientSelected, nullptr, mEditPatForm->getPatientInformation()->Copy());
|
||||
selectedPatientUID = mEditPatForm->getPatientInformation()->PatientUID;
|
||||
EventCenter::Default()->triggerEvent(PatientSelected, nullptr, patientDetailForm->getPatientInformation()->Copy());
|
||||
selectedPatientUID = patientDetailForm->getPatientInformation()->PatientUID;
|
||||
LOG_USER_OPERATION(SelectPatient)
|
||||
}
|
||||
|
||||
void SelectFormWidget::initDetailPanel(QHBoxLayout *contentLayout) {// prepare edit panel
|
||||
mEditPatForm->setObjectName("patientDetailWidget");
|
||||
mEditPatForm->hide();
|
||||
contentLayout->addWidget(mEditPatForm);
|
||||
patientDetailForm->setObjectName("patientDetailWidget");
|
||||
patientDetailForm->hide();
|
||||
contentLayout->addWidget(patientDetailForm);
|
||||
auto* btnShowEdit = new VerticalTextToolButton(this);
|
||||
btnShowEdit->setObjectName("showeditBtn");
|
||||
btnShowEdit->setObjectName("btnShowPanel");
|
||||
btnShowEdit->setFixedHeight(225);
|
||||
btnShowEdit->setVerticalText("Patient Detail");
|
||||
contentLayout->addWidget(btnShowEdit);
|
||||
@@ -202,12 +202,12 @@ void SelectFormWidget::initDetailPanel(QHBoxLayout *contentLayout) {// prepare e
|
||||
|
||||
// btn show slot
|
||||
connect(btnShowEdit, &QToolButton::clicked, [=]() {
|
||||
mEditPatForm->show();
|
||||
patientDetailForm->show();
|
||||
btnShowEdit->hide();
|
||||
});
|
||||
//btn hide slot
|
||||
connect(mEditPatForm, &PatientDetailForm::hideBtnClicked, [=]() {
|
||||
mEditPatForm->hide();
|
||||
connect(patientDetailForm, &PatientDetailForm::hideBtnClicked, [=]() {
|
||||
patientDetailForm->hide();
|
||||
btnShowEdit->show();
|
||||
});
|
||||
}
|
||||
@@ -238,13 +238,13 @@ void SelectFormWidget::initTableView(QHBoxLayout *contentLayout) {// TableView f
|
||||
contentLayout->addWidget(mPatTable);
|
||||
//table current row selection changing event
|
||||
connect(mPatTable, &SlideTableView::currentRowChanged, [=](int row) {
|
||||
setPatientDetail(mPatTable, mModel, mEditPatForm);
|
||||
setPatientDetail(mPatTable, mModel, patientDetailForm);
|
||||
prepareButtons(false);
|
||||
});
|
||||
|
||||
// after sort by column
|
||||
connect(mPatTable->horizontalHeader(), &QHeaderView::sectionClicked, [=](int index){
|
||||
mEditPatForm->clearPatientInformation();
|
||||
patientDetailForm->clearPatientInformation();
|
||||
prepareButtons(false);
|
||||
if(mModel->rowCount() > 0){
|
||||
mPatTable->selectRow(0);
|
||||
|
||||
@@ -36,7 +36,7 @@ private:
|
||||
QToolButton *mBtnSelect;
|
||||
SlideTableView *mPatTable;
|
||||
QSqlTableModel *mModel;
|
||||
PatientDetailForm *mEditPatForm;
|
||||
PatientDetailForm *patientDetailForm;
|
||||
|
||||
void prepareButtons(bool disableALL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user