Hide able edit patient panel.

This commit is contained in:
Krad
2022-01-12 11:24:37 +08:00
parent 386bdf7c5a
commit 7bf85c0b4f
11 changed files with 112 additions and 23 deletions

View File

@@ -18,6 +18,7 @@
#include <QDebug>
#include "log/UserOperationLog.h"
#include <QSortFilterProxyModel>
#include "src/components/VerticalTextToolButton.h"
#define ADD_CENTER_ITEM(row,col,text)\
item = new QTableWidgetItem(text);\
@@ -36,23 +37,7 @@ int queryValue(QSqlTableModel* model, int colID, QVariant var)
SelectFormWidget::SelectFormWidget(QWidget* parent) :
TabFormWidget(parent)
{
// const char* style="QHeaderView::section{background-color:#595959;"
// " min-height:50px;max-height:50px;"
// "font-weight:Bold; font-size:16px; border:1px solid #323232;}"
// "QHeaderView::section:horizontal{border-bottom: 1px solid rgb(0,170,255);}"
// "QHeaderView::section:vertical{min-height:36px;max-height:36px;}"
// "QWidget#edit_patient{min-width:300px;max-width:300px;}"
// "QTableView{border:none}"
// "QTableView{alternate-background-color: #595959;selection-color:white;selection-background-color:#0078d8}"
// "QToolButton#sexBtn{min-width:120px;max-width:120px;font-size:20px;padding:2px;}"
// "QToolButton#sexBtn:disabled{color:silver}"
// "QWidget#sexpanelwidget{border:1px solid silver;}"
// "QWidget#sexpanelwidget:enabled{background-color: #515151;}"
// "QToolButton#sexBtn:checked{border:2px solid darkorange;padding:0px;}"
// ;
//
// this->setStyleSheet(this->styleSheet().append(style));
//init command bar
//init command bar
QHBoxLayout* layout = new QHBoxLayout();
ui->commandWidget->setLayout(layout);
ADD_TOOL_BTN(Account, ":/icons/account.png");
@@ -76,6 +61,7 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
//Init content widget
QHBoxLayout* contentLayout = new QHBoxLayout();
contentLayout->setContentsMargins(5,5,0,5);
this->ui->contentWidget->setLayout(contentLayout);
// TableView for patient
QTableView* table = new SlideableTableView(this);
@@ -125,8 +111,29 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
//edit panel
EditPatientForm* edit_patient = new EditPatientForm(this);
edit_patient->setObjectName("edit_patient");
edit_patient->hide();
contentLayout->addWidget(edit_patient);
//select default row 0
auto *btnShowEdit = new VerticalTextToolButton(this);
btnShowEdit->setObjectName("showeditBtn");
btnShowEdit->setIcon(QIcon(":/icons/edit.png"));
btnShowEdit->setIconSize(QSize(30, 30));
btnShowEdit->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
btnShowEdit->setFixedHeight(225);
// btnShowEdit->setVerticalText("E\nd\ni\nt\nP\na\nn\ne\nl");
btnShowEdit->setVerticalText("Patient Detail");
contentLayout->addWidget(btnShowEdit);
contentLayout->setAlignment(btnShowEdit, Qt::AlignmentFlag::AlignTop);
connect(btnShowEdit,&QToolButton::clicked,[=](){
edit_patient->show();
btnShowEdit->hide();
});
connect(edit_patient, &EditPatientForm::hideBtnClicked, [=](){
edit_patient->hide();
btnShowEdit->show();
});
//select default row 0
if (model->rowCount() > 0)
{
table->selectRow(0);
@@ -136,7 +143,7 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
pat. val = model->data(model->index(currentRow,PatientInformationEnum:: val)).toString();
EDIT_PATIENT()
#undef ADD_PATIENT_PROPERTY
edit_patient->setPatientInformation(&pat);
edit_patient->setPatientInformation(&pat);
}
//events----------------------------------------------------------------------
//table current row selection changing event