Add new UI logic for ScanFormWidget, which is mainly about button enable and disable in different mode.

This commit is contained in:
Krad
2021-10-13 17:36:38 +08:00
parent 89e46631fa
commit 6836fe9c76
2 changed files with 35 additions and 3 deletions

View File

@@ -99,12 +99,34 @@ ScanFormWidget::ScanFormWidget(QWidget *parent) : TabFormWidget(parent) {
contentLayout->addWidget(param_widget); contentLayout->addWidget(param_widget);
pat_inf = patient_information; pat_inf = patient_information;
btnScan->setEnabled(false);
btnRefresh->setEnabled(false);
btnPreview->setEnabled(false);
btnStop->setEnabled(false);
//Events--------------------------------------------------------------- //Events---------------------------------------------------------------
connect(EventCenter::Default(),&EventCenter::PatientSelected,[=](QObject* sender,QObject* data){ connect(EventCenter::Default(),&EventCenter::PatientSelected,[=](QObject* sender,QObject* data){
if(unset)
{
btnScan->setEnabled(true);
btnRefresh->setEnabled(true);
btnPreview->setEnabled(true);
btnStop->setEnabled(true);
unset = false;
}
patient_information->setPatientInformation((PatientInformation*)data); patient_information->setPatientInformation((PatientInformation*)data);
}); });
connect(group, SIGNAL(buttonClicked(int)),this,SLOT(protocolChanged(int))); connect(group, SIGNAL(buttonClicked(int)),this,SLOT(protocolChanged(int)));
previewfunc = [=](bool val)->void{
btnPreview->setCheckable(val);
btnPreview->setChecked(val);
btnPreview->setEnabled(!val);
btnRefresh->setEnabled(!val);
btnScan->setEnabled(!val);
};
} }
ScanFormWidget::~ScanFormWidget() { ScanFormWidget::~ScanFormWidget() {
@@ -115,3 +137,9 @@ void ScanFormWidget::protocolChanged(int type) {
printf("%d\r\n",type); printf("%d\r\n",type);
pat_inf->setProtocol(type); pat_inf->setProtocol(type);
} }
void ScanFormWidget::setPreviewing(bool val) {
if(previewfunc) previewfunc(val);
}

View File

@@ -6,15 +6,19 @@
#define GUI_SCANFORMWIDGET_H #define GUI_SCANFORMWIDGET_H
#include "tabformwidget.h" #include "tabformwidget.h"
#include <functional>
class PatientInformationForm; 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();
void setPreviewing(bool val);
private: private:
PatientInformationForm* pat_inf= nullptr; PatientInformationForm* pat_inf= nullptr;
bool unset = true;
bool previewing= false;
std::function<void(bool)> previewfunc = nullptr;
private slots: private slots:
void protocolChanged(int type); void protocolChanged(int type);