Refactoring the new dialog manager module and fixed keyboard problem in Linux touch panel.
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
#include "db/SQLHelper.h"
|
||||
#include "event/EventCenter.h"
|
||||
#include "dialogs/DialogManager.h"
|
||||
#include "dialogs/AlertDialog.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "components/VerticalTextToolButton.h"
|
||||
|
||||
@@ -113,18 +112,8 @@ void SelectFormWidget::initPatEditButtons(QHBoxLayout *layout) {
|
||||
|
||||
void SelectFormWidget::editPatient() {
|
||||
bool addFlag = sender() == mBtnAdd;
|
||||
EditPatientDialog dialog(this);
|
||||
if (addFlag){
|
||||
dialog.clearPatientInformation();
|
||||
}
|
||||
else{
|
||||
dialog.setPatientInformation(patientDetailForm->getPatientInformation());
|
||||
}
|
||||
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
dialog.setModel(mModel);
|
||||
// accept change
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
if (DialogManager::Default()->requestEditPatientInfo(addFlag ? nullptr:patientDetailForm->getPatientInformation(),mModel) == QDialog::Accepted) {
|
||||
if (addFlag){
|
||||
mPatTable->selectRow(0);
|
||||
mModel->selectRow(0);
|
||||
@@ -140,23 +129,15 @@ void SelectFormWidget::editPatient() {
|
||||
|
||||
void SelectFormWidget::delPatient() {
|
||||
if (mPatTable->currentIndex().row() < 0) return;
|
||||
AlertDialog dialog(this);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
QString pUid = mModel->index(mPatTable->currentIndex().row(), PatientUID).data().toString();
|
||||
// patient has been selected as the scan patient!
|
||||
if (selectedPatientUID == pUid){
|
||||
dialog.setButtonMode(OkOnly);
|
||||
dialog.setTitle(tr("Alert"));
|
||||
dialog.setAlertMessage(QString(tr("Can't delete selected Patient !")));
|
||||
dialog.exec();
|
||||
DialogManager::Default()->requestAlertMessage(tr("Can't delete selected Patient !"),DialogButtonMode::OkOnly,tr("Alert"));
|
||||
return;
|
||||
}
|
||||
// not the selected one, confirm!
|
||||
dialog.setButtonMode(OkAndCancel);
|
||||
dialog.setTitle("Confirm");
|
||||
QString pat_name = mModel->index(mPatTable->currentIndex().row(), Name).data().toString();
|
||||
dialog.setAlertMessage(QString(tr("Delete Patient \"%1\" ?")).arg(pat_name));
|
||||
if (dialog.exec() != QDialog::Accepted) return;
|
||||
if (DialogManager::Default()->requestAlertMessage(QString(tr("Delete Patient \"%1\" ?")).arg(pat_name),DialogButtonMode::OkAndCancel,tr("Confirm")) != QDialog::Accepted) return;
|
||||
// need delete clear edit panel detail
|
||||
patientDetailForm->clearPatientInformation();
|
||||
mModel->setData(mModel->index(mPatTable->currentIndex().row(), Flag), 9);
|
||||
@@ -171,10 +152,7 @@ void SelectFormWidget::delPatient() {
|
||||
}
|
||||
} else {
|
||||
//TODO:error handle
|
||||
dialog.setButtonMode(OkOnly);
|
||||
dialog.setTitle(tr("Alert"));
|
||||
dialog.setAlertMessage(QString(tr("Can't delete selected Patient , db submit error!")));
|
||||
dialog.exec();
|
||||
DialogManager::Default()->requestAlertMessage(tr("Can't delete selected Patient , db submit error!"),DialogButtonMode::OkOnly,tr("Alert"));
|
||||
}
|
||||
prepareButtons(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user