Change SelectFormWidget layout and active logic.
This commit is contained in:
@@ -6,102 +6,113 @@
|
||||
#include <QButtonGroup>
|
||||
#include <QDateTime>
|
||||
#include <qboxlayout.h>
|
||||
#include <QFormLayout>
|
||||
#include <qdebug.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
#include "event/EventCenter.h"
|
||||
|
||||
PatientDetailForm::PatientDetailForm(QWidget* parent) :
|
||||
QWidget(parent),
|
||||
mUI(new Ui::PatientDetailForm)
|
||||
, mBtnEdit(new QToolButton())
|
||||
, mBtnDelete(new QToolButton())
|
||||
, mBtnPlaceWidget(new QWidget(this))
|
||||
, mLblMessage(new QLabel(this))
|
||||
QWidget(parent)
|
||||
, mLblPatInfTitle(new QLabel(this))
|
||||
, mLblDOB(new QLabel(this))
|
||||
, mLblName(new QLabel(this))
|
||||
, mLblPatID(new QLabel(this))
|
||||
, mLblSex(new QLabel(this))
|
||||
, mLblAccno(new QLabel(this))
|
||||
, mLblAddDate(new QLabel(this))
|
||||
|
||||
{
|
||||
mUI->setupUi(this);
|
||||
mUI->lblPatInfPanel->setObjectName("PatInfTitle");
|
||||
mUI->lblIcon->setObjectName("PatIcon");
|
||||
mUI->lbl_DOB->setObjectName("displayDetail");
|
||||
mUI->lbl_Name->setObjectName("displayDetail");
|
||||
mUI->lblPatID->setObjectName("displayDetail");
|
||||
mUI->lbl_Sex->setObjectName("displayDetail");
|
||||
mUI->lblAccno->setObjectName("displayDetail");
|
||||
mUI->lblAddDate->setObjectName("displayDetail");
|
||||
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, this,&PatientDetailForm::reloadLanguage);
|
||||
mBtnPlaceWidget->setFixedHeight(120);
|
||||
mUI->verticalLayout_2->setSpacing(50);
|
||||
mLblPatInfTitle->setObjectName("PatInfTitle");
|
||||
mLblDOB->setObjectName("displayDetail");
|
||||
mLblName->setObjectName("displayDetail");
|
||||
mLblPatID->setObjectName("displayDetail");
|
||||
mLblSex->setObjectName("displayDetail");
|
||||
mLblAccno->setObjectName("displayDetail");
|
||||
mLblAddDate->setObjectName("displayDetail");
|
||||
|
||||
mUI->verticalLayout_3->insertWidget(5, mBtnPlaceWidget);
|
||||
mUI->verticalLayout_3->insertWidget(5, mLblMessage);
|
||||
mLblMessage->setVisible(false);
|
||||
QHBoxLayout * layout = new QHBoxLayout(mBtnPlaceWidget);
|
||||
mBtnEdit->setObjectName("btnPatEdit");
|
||||
mBtnDelete->setObjectName("btnPatDelete");
|
||||
mBtnEdit->setText(tr("Edit"));
|
||||
mBtnDelete->setText(tr("Delete"));
|
||||
layout->addWidget(mBtnEdit);
|
||||
layout->addWidget(mBtnDelete);
|
||||
connect(mBtnEdit, &QToolButton::clicked, [=](){
|
||||
emit editClicked();
|
||||
});
|
||||
connect(mBtnDelete, &QToolButton::clicked, [=](){
|
||||
emit deleteClicked();
|
||||
});
|
||||
setBtnEnable(false);
|
||||
auto layout = new QVBoxLayout(this);
|
||||
// mLblPatInfTitle->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
mLblPatInfTitle->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(mLblPatInfTitle);
|
||||
mLblPatInfTitle->setText(tr("Patient Detail"));
|
||||
addDetailLabel(layout,tr("Name")+":", mLblName);
|
||||
addDetailLabel(layout,tr("Gender")+":", mLblSex);
|
||||
addDetailLabel(layout,tr("Birth Date")+":", mLblDOB);
|
||||
addDetailLabel(layout,tr("PatientID")+":", mLblPatID);
|
||||
addDetailLabel(layout,tr("AccNo")+":", mLblAccno);
|
||||
|
||||
auto widgetLayout = new QHBoxLayout;
|
||||
layout->addLayout(widgetLayout);
|
||||
|
||||
mLblAddDateTitle = new QLabel(tr("Add Date")+":",this);
|
||||
mLblAddDateTitle->setObjectName("displayTitle");
|
||||
widgetLayout->addWidget(mLblAddDateTitle);
|
||||
widgetLayout->addWidget(mLblAddDate);
|
||||
|
||||
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, this,&PatientDetailForm::reloadLanguage);
|
||||
layout->addSpacerItem(new QSpacerItem(2,2,QSizePolicy::Expanding, QSizePolicy::Expanding));
|
||||
}
|
||||
|
||||
void PatientDetailForm::addDetailLabel(QVBoxLayout *layout, const QString& aTitleText, QLabel* aLabel)
|
||||
{
|
||||
auto widgetLayout = new QHBoxLayout;
|
||||
layout->addLayout(widgetLayout);
|
||||
|
||||
auto lblTitle = new QLabel(aTitleText,this);
|
||||
mBtnList.append(lblTitle);
|
||||
lblTitle->setObjectName("displayTitle");
|
||||
widgetLayout->addWidget(lblTitle);
|
||||
widgetLayout->addWidget(aLabel);
|
||||
}
|
||||
|
||||
void PatientDetailForm::reloadLanguage() {
|
||||
mUI->retranslateUi(this);
|
||||
mUI->lbl_Sex->setText(mStore.Sex == "F" ? tr("Female") : (mStore.Sex == "M" ? tr("Male") : tr("Other")));
|
||||
mLblSex->setText(mStore.Sex == "F" ? tr("Female") : (mStore.Sex == "M" ? tr("Male") : tr("Other")));
|
||||
QList<std::string> strArray = {"Name","Gender","Birth Date","PatientID","AccNo"};
|
||||
for (size_t i = 0; i < strArray.length(); i++)
|
||||
{
|
||||
mBtnList[i]->setText(tr(strArray[i].data())+":");
|
||||
}
|
||||
mLblAddDateTitle->setText(tr("Add Date")+":");
|
||||
mLblPatInfTitle->setText(tr("Patient Detail"));
|
||||
|
||||
}
|
||||
|
||||
PatientDetailForm::~PatientDetailForm()
|
||||
{
|
||||
delete mUI;
|
||||
|
||||
}
|
||||
|
||||
void PatientDetailForm::setPatientInformation(PatientInformation* information) {
|
||||
if (information)
|
||||
{
|
||||
mUI->lblPatID->setText(tr("PatientID: ")+information->ID);
|
||||
mUI->lbl_DOB->setText(" "+information->BirthDate);
|
||||
mUI->lbl_Name->setText(" "+information->Name);
|
||||
mUI->lbl_Sex->setText(" "+ (information->Sex == "F" ? tr("Female") : (information->Sex == "M" ? tr("Male") : tr("Other"))));
|
||||
mLblPatID->setText(information->ID);
|
||||
mLblDOB->setText(information->BirthDate);
|
||||
mLblName->setText(information->Name);
|
||||
mLblSex->setText((information->Sex == "F" ? tr("Female") : (information->Sex == "M" ? tr("Male") : tr("Other"))));
|
||||
mCurrentPatientUID = information->PatientUID;
|
||||
mUI->lblAddDate->setText(tr("Add Date: ")+ QDateTime::fromString(information->AddDate, Qt::ISODate).toString("yyyy-MM-dd HH:mm:ss"));
|
||||
mUI->lblAccno->setText(tr("AccNo: ")+information->AccessionNumber);
|
||||
mLblAddDate->setText(QDateTime::fromString(information->AddDate, Qt::ISODate).toString("yyyy-MM-dd HH:mm:ss"));
|
||||
mLblAccno->setText(information->AccessionNumber);
|
||||
|
||||
mStore = *information;
|
||||
setBtnEnable(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void PatientDetailForm::clearPatientInformation() {
|
||||
mUI->lblPatID->clear();
|
||||
mUI->lbl_DOB->clear();
|
||||
mUI->lbl_Name->clear();
|
||||
mUI->lbl_Sex->clear();
|
||||
mUI->lblAddDate->clear();
|
||||
mUI->lblAccno->clear();
|
||||
mLblPatID->clear();
|
||||
mLblDOB->clear();
|
||||
mLblName->clear();
|
||||
mLblSex->clear();
|
||||
mLblAddDate->clear();
|
||||
mLblAccno->clear();
|
||||
}
|
||||
|
||||
void PatientDetailForm::confirmModeOn(int protocol)
|
||||
{
|
||||
mBtnPlaceWidget->setVisible(false);
|
||||
mLblMessage->setVisible(true);
|
||||
|
||||
mUI->lblPatInfPanel->setText(tr("Scan with this Patient?"));
|
||||
mUI->lblAddDate->setText(tr("Protocol: ")+(protocol==0?tr("Left"):tr("Right")));
|
||||
|
||||
}
|
||||
|
||||
void PatientDetailForm::setBtnEnable(bool enable)
|
||||
{
|
||||
mBtnDelete->setEnabled(enable);
|
||||
mBtnEdit->setEnabled(enable);
|
||||
mLblPatInfTitle->setText(tr("Scan with this Patient?"));
|
||||
mLblAddDate->setText((protocol==0?tr("Left"):tr("Right")));
|
||||
mLblAddDateTitle->setText(tr("Protocol"));
|
||||
}
|
||||
|
||||
void PatientDetailForm::storePatientInformation() {
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
#ifndef EDITPATIENTFORM_H
|
||||
#define EDITPATIENTFORM_H
|
||||
namespace Ui {
|
||||
class PatientDetailForm;
|
||||
}
|
||||
|
||||
#include <QWidget>
|
||||
#include "PatientInformation.h"
|
||||
class QToolButton;
|
||||
class QLabel;
|
||||
class QVBoxLayout;
|
||||
|
||||
class PatientDetailForm : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PatientDetailForm(QWidget *parent = nullptr);
|
||||
void addDetailLabel(QVBoxLayout *layout, const QString& aTitleText, QLabel* aLabel);
|
||||
~PatientDetailForm();
|
||||
void setPatientInformation(PatientInformation * information);
|
||||
PatientInformation * getPatientInformation(){
|
||||
void setPatientInformation(PatientInformation *information);
|
||||
PatientInformation *getPatientInformation()
|
||||
{
|
||||
return &mStore;
|
||||
}
|
||||
void clearPatientInformation();
|
||||
void confirmModeOn(int protocol);
|
||||
void setBtnEnable(bool enable);
|
||||
void clearPatientInformation();
|
||||
signals:
|
||||
void hideBtnClicked();
|
||||
void editClicked();
|
||||
@@ -29,14 +29,18 @@ signals:
|
||||
private:
|
||||
void storePatientInformation();
|
||||
void reloadLanguage();
|
||||
Ui::PatientDetailForm *mUI;
|
||||
QString mCurrentPatientUID;
|
||||
QString mAddDate;
|
||||
PatientInformation mStore;
|
||||
QWidget * mBtnPlaceWidget;
|
||||
QToolButton *mBtnEdit;
|
||||
QToolButton *mBtnDelete;
|
||||
QLabel* mLblMessage;
|
||||
QLabel* mLblPatInfTitle;
|
||||
QLabel* mLblDOB;
|
||||
QLabel* mLblName;
|
||||
QLabel* mLblPatID;
|
||||
QLabel* mLblSex;
|
||||
QLabel* mLblAccno;
|
||||
QLabel* mLblAddDate;
|
||||
QLabel* mLblAddDateTitle;
|
||||
QList<QLabel*> mBtnList;
|
||||
};
|
||||
|
||||
#endif // EDITPATIENTFORM_H
|
||||
|
||||
@@ -1,207 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PatientDetailForm</class>
|
||||
<widget class="QWidget" name="PatientDetailForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>466</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblPatInfPanel">
|
||||
<property name="text">
|
||||
<string>Patient Information</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_4">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblIcon">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>111</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="PatinfLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_Name">
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_Sex">
|
||||
<property name="text">
|
||||
<string>Gender</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_DOB">
|
||||
<property name="text">
|
||||
<string>Date Of Birth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblPatID">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblAccno">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><br/></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblAddDate">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <QScroller>
|
||||
#include <QHeaderView>
|
||||
#include <QUuid>
|
||||
#include <QLabel>
|
||||
|
||||
#include <QDate>
|
||||
#include <QSqlRecord>
|
||||
#include <QDebug>
|
||||
@@ -25,11 +27,10 @@
|
||||
|
||||
SelectFormWidget::SelectFormWidget(QWidget* parent)
|
||||
: TabFormWidget(parent)
|
||||
, mBtnAccount(new QToolButton(this))
|
||||
, mBtnWorklist(new QToolButton(this))
|
||||
, mBtnEdit(new QToolButton())
|
||||
, mBtnDelete(new QToolButton())
|
||||
, mBtnAdd(new QToolButton(this))
|
||||
, mBtnSelect(new QToolButton(this))
|
||||
, mBtnTurnOff(new QToolButton(this))
|
||||
, mPatTable(new SlideTableView(this))
|
||||
, mModel(nullptr)
|
||||
, patientDetailForm(new PatientDetailForm(this))
|
||||
@@ -41,18 +42,25 @@ SelectFormWidget::SelectFormWidget(QWidget* parent)
|
||||
//init command bar
|
||||
auto layout = new QHBoxLayout();
|
||||
ui->commandWidget->setLayout(layout);
|
||||
initGeneralButtons(layout);
|
||||
|
||||
layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
|
||||
addVerticalLine(layout);
|
||||
initPatEditButtons(layout);
|
||||
initDataModel();
|
||||
//Init content widget
|
||||
auto* contentLayout = new QHBoxLayout(this->ui->contentWidget);
|
||||
auto contantContanerLayout = new QVBoxLayout(this->ui->contentWidget);
|
||||
contantContanerLayout->setMargin(0);
|
||||
auto selectTabTitle = new QLabel(tr("Patient Information Manage"));
|
||||
selectTabTitle->setObjectName("selectTabTitle");
|
||||
contantContanerLayout->addWidget(selectTabTitle);
|
||||
auto contentLayout = new QHBoxLayout;
|
||||
contantContanerLayout->addLayout(contentLayout);
|
||||
contentLayout->setContentsMargins(0, 0, 0, 0);
|
||||
initDetailPanel(contentLayout);
|
||||
addVerticalLine(contentLayout);
|
||||
initTableView(contentLayout);
|
||||
auto gridBox = new QVBoxLayout;
|
||||
contentLayout->addLayout(gridBox);
|
||||
initTableView(gridBox);
|
||||
gridBox->addWidget(ui->commandWidget);
|
||||
//select default row 0
|
||||
if (mModel->rowCount() > 0)
|
||||
{
|
||||
@@ -84,56 +92,43 @@ void SelectFormWidget::prepareButtons(bool disableALL) {
|
||||
bool stateFlag = (mPatTable->currentIndex().row() >= 0);
|
||||
|
||||
mBtnAdd->setEnabled(!anonymousMode && !disableALL);
|
||||
mBtnWorklist->setEnabled(!anonymousMode && !disableALL);
|
||||
patientDetailForm->setBtnEnable(!anonymousMode && stateFlag && !disableALL);
|
||||
// if (mBtnAdd)mBtnEdit->setEnabled(!anonymousMode && stateFlag && !disableALL);
|
||||
// if (mBtnAdd)mBtnDelete->setEnabled(!anonymousMode&& stateFlag && !disableALL);
|
||||
mBtnSelect->setEnabled(stateFlag && !disableALL);
|
||||
}
|
||||
|
||||
void SelectFormWidget::initGeneralButtons(QHBoxLayout *layout) {
|
||||
mBtnAccount->setObjectName("btnAccount");
|
||||
mBtnAccount->setText(tr("Account"));
|
||||
layout->addWidget(mBtnAccount);
|
||||
mBtnTurnOff->setObjectName("btnShutDown");
|
||||
mBtnTurnOff->setText(tr("ShutDown"));
|
||||
layout->addWidget(mBtnTurnOff);
|
||||
// mBtn account slot
|
||||
connect(mBtnAccount, &QToolButton::clicked, DialogManager::Default(),&DialogManager::requestEditSelfAccount);
|
||||
connect(mBtnTurnOff, &QToolButton::clicked, []()
|
||||
{
|
||||
if(DialogManager::Default()->requestAlertMessage(QString(tr("Shut down now ?")), DialogButtonMode::OkAndCancel,tr("Shut Down")) == QDialog::Accepted)
|
||||
{
|
||||
LOG_USER_OPERATION("Shut Down")
|
||||
EventCenter::Default()->triggerEvent(GUIEvents::RequestShutdown, nullptr, nullptr);
|
||||
}
|
||||
});
|
||||
connect(mBtnWorklist, &QToolButton::clicked, [&]()
|
||||
{
|
||||
DialogManager::Default()->requestGetWorkList();
|
||||
});
|
||||
}
|
||||
|
||||
void SelectFormWidget::initPatEditButtons(QHBoxLayout *layout) {
|
||||
mBtnAdd->setObjectName("btnAdd");
|
||||
mBtnWorklist->setObjectName("btnWorklist");
|
||||
mBtnEdit->setObjectName("btnPatEdit");
|
||||
mBtnDelete->setObjectName("btnPatDelete");
|
||||
mBtnSelect->setObjectName("btnSelect");
|
||||
|
||||
mBtnEdit->setText(tr("Edit"));
|
||||
mBtnDelete->setText(tr("Delete"));
|
||||
mBtnAdd->setText(tr("Add"));
|
||||
mBtnSelect->setText(tr("Select"));
|
||||
mBtnWorklist->setText(tr("Worklist"));
|
||||
layout->addWidget(mBtnAdd);
|
||||
layout->addWidget(mBtnWorklist);
|
||||
layout->addWidget(mBtnEdit);
|
||||
layout->addWidget(mBtnDelete);
|
||||
addVerticalLine(layout);
|
||||
layout->addWidget(mBtnSelect);
|
||||
|
||||
// btn add slot
|
||||
connect(mBtnAdd, &QToolButton::clicked, this, &SelectFormWidget::editPatient);
|
||||
|
||||
// btn edit slot
|
||||
connect(mBtnEdit, &QToolButton::clicked, this, &SelectFormWidget::editPatient);
|
||||
|
||||
// btn del slot
|
||||
connect(mBtnDelete, &QToolButton::clicked, this, &SelectFormWidget::delPatient);
|
||||
|
||||
// mBtn select slot
|
||||
connect(mBtnSelect, &QToolButton::clicked, this, &SelectFormWidget::selectPatient);
|
||||
}
|
||||
|
||||
void SelectFormWidget::editPatient() {
|
||||
bool addFlag = sender() == mBtnAdd;
|
||||
auto index = mPatTable->currentIndex();
|
||||
// accept change
|
||||
if (DialogManager::Default()->requestEditPatientInfo(addFlag ? nullptr:patientDetailForm->getPatientInformation(),mModel) == QDialog::Accepted) {
|
||||
if (addFlag){
|
||||
@@ -142,7 +137,8 @@ void SelectFormWidget::editPatient() {
|
||||
LOG_USER_OPERATION(QString("Add Patient, ID: %1").arg(patientDetailForm->getPatientInformation()->ID))
|
||||
}
|
||||
else{
|
||||
mPatTable->clicked(mPatTable->currentIndex());
|
||||
mPatTable->selectRow(index.row());
|
||||
mModel->selectRow(index.row());
|
||||
setPatientDetail(mPatTable, mModel, patientDetailForm);
|
||||
LOG_USER_OPERATION(QString("Edit Patient, ID: %1").arg(patientDetailForm->getPatientInformation()->ID))
|
||||
}
|
||||
@@ -189,21 +185,10 @@ void SelectFormWidget::selectPatient() {
|
||||
|
||||
void SelectFormWidget::initDetailPanel(QHBoxLayout *contentLayout) {// prepare edit panel
|
||||
patientDetailForm->setObjectName("patientDetailWidget");
|
||||
// patientDetailForm->hide();
|
||||
contentLayout->addWidget(patientDetailForm);
|
||||
auto* btnShowEdit = new VerticalTextToolButton(this);
|
||||
btnShowEdit->setObjectName("btnShowPanel");
|
||||
btnShowEdit->setFixedHeight(225);
|
||||
btnShowEdit->setVerticalText("Patient Detail");
|
||||
btnShowEdit->hide();
|
||||
contentLayout->addWidget(btnShowEdit);
|
||||
contentLayout->setAlignment(btnShowEdit, Qt::AlignTop);
|
||||
|
||||
connect(patientDetailForm, &PatientDetailForm::editClicked, this, &SelectFormWidget::editPatient);
|
||||
connect(patientDetailForm, &PatientDetailForm::deleteClicked, this, &SelectFormWidget::delPatient);
|
||||
}
|
||||
|
||||
void SelectFormWidget::initTableView(QHBoxLayout *contentLayout)
|
||||
void SelectFormWidget::initTableView(QLayout *contentLayout)
|
||||
{
|
||||
// TableView for patient
|
||||
mPatTable->setAlternatingRowColors(true);
|
||||
@@ -212,9 +197,8 @@ void SelectFormWidget::initTableView(QHBoxLayout *contentLayout)
|
||||
mPatTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
mPatTable->verticalHeader()->setDefaultSectionSize(38);
|
||||
mPatTable->horizontalHeader()->setStretchLastSection(true);
|
||||
//data from SQLITE
|
||||
//
|
||||
//avoid pan comsumed by tableview!
|
||||
|
||||
//avoid pan comsumed by tableview!
|
||||
mPatTable->viewport()->ungrabGesture(Qt::PanGesture);
|
||||
|
||||
mPatTable->setSortingEnabled(true); // enable sortingEnabled
|
||||
@@ -250,7 +234,7 @@ void SelectFormWidget::initTableView(QHBoxLayout *contentLayout)
|
||||
mPatTable->setItemDelegateForColumn(6, patientAddDateDelegate);
|
||||
}
|
||||
|
||||
void SelectFormWidget::initDataModel() {//TODO:单独初始化预防SQL错误
|
||||
void SelectFormWidget::initDataModel() {
|
||||
mModel = SQLHelper::getTable("Patient");
|
||||
WorkListManager::getInstance()->setTableModel(mModel);
|
||||
mModel->sort(mModel->record().indexOf("AddDate"), Qt::DescendingOrder);
|
||||
@@ -302,9 +286,10 @@ void SelectFormWidget::reloadLanguage(){
|
||||
mModel->setHeaderData(6, Qt::Horizontal, tr("Add Date"));
|
||||
mModel->setHeaderData(7, Qt::Horizontal, tr("Comment"));
|
||||
|
||||
mBtnAccount->setText(tr("Account"));
|
||||
//mBtnWorklist->setText(tr("Worklist"));
|
||||
mBtnEdit->setText(tr("Edit"));
|
||||
mBtnDelete->setText(tr("Delete"));
|
||||
mBtnAdd->setText(tr("Add"));
|
||||
mBtnSelect->setText(tr("Select"));
|
||||
}
|
||||
|
||||
void SelectFormWidget::updateDataByAnonymousMode(){
|
||||
|
||||
@@ -29,19 +29,16 @@ private:
|
||||
|
||||
void setPatientDetail(const SlideTableView *table, const QSqlTableModel *model, PatientDetailForm *edit_patient) const;
|
||||
|
||||
QToolButton *mBtnAccount;
|
||||
QToolButton *mBtnWorklist;
|
||||
QToolButton *mBtnEdit;
|
||||
QToolButton *mBtnDelete;
|
||||
QToolButton *mBtnAdd;
|
||||
QToolButton *mBtnSelect;
|
||||
QToolButton *mBtnTurnOff;
|
||||
SlideTableView *mPatTable;
|
||||
QSqlTableModel *mModel;
|
||||
PatientDetailForm *patientDetailForm;
|
||||
|
||||
void prepareButtons(bool disableALL);
|
||||
|
||||
void initGeneralButtons(QHBoxLayout *layout);
|
||||
|
||||
void initPatEditButtons(QHBoxLayout *layout);
|
||||
|
||||
void editPatient();
|
||||
@@ -54,7 +51,7 @@ private:
|
||||
|
||||
void initDetailPanel(QHBoxLayout *contentLayout);
|
||||
|
||||
void initTableView(QHBoxLayout *contentLayout);
|
||||
void initTableView(QLayout *contentLayout);
|
||||
|
||||
void reloadLanguage();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user