Add new UI logic for ScanFormWidget, which is mainly about button enable and disable in different mode.
This commit is contained in:
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user