Scan tab Patient information logic and protocol logic.

This commit is contained in:
Krad
2021-10-12 17:43:12 +08:00
parent 68a7f32027
commit 14169b3072
4 changed files with 48 additions and 4 deletions

View File

@@ -10,6 +10,7 @@
#include "guimacros.h" #include "guimacros.h"
#include "patientinformationform.h" #include "patientinformationform.h"
#include <QButtonGroup> #include <QButtonGroup>
#include "event/EventCenter.h"
ScanFormWidget::ScanFormWidget(QWidget *parent) : TabFormWidget(parent) { ScanFormWidget::ScanFormWidget(QWidget *parent) : TabFormWidget(parent) {
const char* style="QWidget#PatientInformationForm{min-width:300px;max-width:300px; margin-right:10}" const char* style="QWidget#PatientInformationForm{min-width:300px;max-width:300px; margin-right:10}"
@@ -41,8 +42,8 @@ ScanFormWidget::ScanFormWidget(QWidget *parent) : TabFormWidget(parent) {
btnLeft->setCheckable(true); btnLeft->setCheckable(true);
btnLeft->setChecked(true); btnLeft->setChecked(true);
btnRight->setCheckable(true); btnRight->setCheckable(true);
group->addButton(btnRight); group->addButton(btnRight,1);
group->addButton(btnLeft); group->addButton(btnLeft,0);
layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding)); layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
QWidget* spacerLine2= new QWidget(this); QWidget* spacerLine2= new QWidget(this);
spacerLine2->setFixedWidth(2); spacerLine2->setFixedWidth(2);
@@ -96,9 +97,21 @@ ScanFormWidget::ScanFormWidget(QWidget *parent) : TabFormWidget(parent) {
paramLayout->addWidget(lbl_end2); paramLayout->addWidget(lbl_end2);
paramLayout->addSpacerItem(new QSpacerItem(20,20,QSizePolicy::Minimum,QSizePolicy::Expanding)); paramLayout->addSpacerItem(new QSpacerItem(20,20,QSizePolicy::Minimum,QSizePolicy::Expanding));
contentLayout->addWidget(param_widget); contentLayout->addWidget(param_widget);
pat_inf = patient_information;
//Events---------------------------------------------------------------
connect(EventCenter::Default(),&EventCenter::PatientSelected,[=](QObject* sender,QObject* data){
patient_information->setPatientInformation((PatientInformation*)data);
});
connect(group, SIGNAL(buttonClicked(int)),this,SLOT(protocolChanged(int)));
} }
ScanFormWidget::~ScanFormWidget() { ScanFormWidget::~ScanFormWidget() {
} }
void ScanFormWidget::protocolChanged(int type) {
printf("%d\r\n",type);
pat_inf->setProtocol(type);
}

View File

@@ -6,11 +6,18 @@
#define GUI_SCANFORMWIDGET_H #define GUI_SCANFORMWIDGET_H
#include "tabformwidget.h" #include "tabformwidget.h"
class PatientInformationForm;
class ScanFormWidget :public TabFormWidget { class ScanFormWidget :public TabFormWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ScanFormWidget(QWidget *parent = nullptr); explicit ScanFormWidget(QWidget *parent = nullptr);
~ScanFormWidget(); ~ScanFormWidget();
private:
PatientInformationForm* pat_inf= nullptr;
private slots:
void protocolChanged(int type);
}; };

View File

@@ -11,4 +11,26 @@ PatientInformationForm::PatientInformationForm(QWidget *parent) :
PatientInformationForm::~PatientInformationForm() PatientInformationForm::~PatientInformationForm()
{ {
delete ui; delete ui;
if (inf) delete inf;
}
void PatientInformationForm::setPatientInformation(PatientInformation* information) {
ui->lbl_ID->setText(information->ID);
ui->lbl_Date->setText(information->BirthDate);
ui->lbl_Name->setText(information->Name);
ui->lbl_Sex->setText(information->Sex);
inf = information;
}
void PatientInformationForm::setProtocol(int type) {
switch(type)
{
case 0:
ui->lbl_Protocol->setText("LEFT ONLY");
break;
case 1:
default:
ui->lbl_Protocol->setText("RIGHT ONLY");
break;
}
} }

View File

@@ -2,7 +2,7 @@
#define PATIENTINFORMATIONFORM_H #define PATIENTINFORMATIONFORM_H
#include <QWidget> #include <QWidget>
#include "editpatientform.h"
namespace Ui { namespace Ui {
class PatientInformationForm; class PatientInformationForm;
} }
@@ -14,9 +14,11 @@ class PatientInformationForm : public QWidget
public: public:
explicit PatientInformationForm(QWidget *parent = nullptr); explicit PatientInformationForm(QWidget *parent = nullptr);
~PatientInformationForm(); ~PatientInformationForm();
void setPatientInformation(PatientInformation* information);
void setProtocol(int type);
private: private:
Ui::PatientInformationForm *ui; Ui::PatientInformationForm *ui;
PatientInformation* inf = nullptr;
}; };
#endif // PATIENTINFORMATIONFORM_H #endif // PATIENTINFORMATIONFORM_H