bug fixes
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
#include <QSortFilterProxyModel>
|
||||
#include "src/components/VerticalTextToolButton.h"
|
||||
|
||||
#include <QScroller>
|
||||
|
||||
#define ADD_CENTER_ITEM(row,col,text)\
|
||||
item = new QTableWidgetItem(text);\
|
||||
item->setTextAlignment(Qt::AlignmentFlag::AlignCenter);\
|
||||
@@ -61,7 +63,7 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
||||
|
||||
//Init content widget
|
||||
QHBoxLayout* contentLayout = new QHBoxLayout();
|
||||
contentLayout->setContentsMargins(5,5,0,5);
|
||||
contentLayout->setContentsMargins(5, 5, 0, 5);
|
||||
this->ui->contentWidget->setLayout(contentLayout);
|
||||
// TableView for patient
|
||||
QTableView* table = new SlideableTableView(this);
|
||||
@@ -72,7 +74,9 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
||||
table->verticalHeader()->setDefaultSectionSize(38);
|
||||
table->horizontalHeader()->setStretchLastSection(true);
|
||||
//data from SQLITE
|
||||
|
||||
//
|
||||
//avoid pan comsumed by tableview!
|
||||
table->viewport()->ungrabGesture(Qt::PanGesture);
|
||||
|
||||
auto model = SQLHelper::getTable("Patient");
|
||||
model->setFilter("Flag=0");
|
||||
@@ -111,29 +115,29 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
||||
//edit panel
|
||||
EditPatientForm* edit_patient = new EditPatientForm(this);
|
||||
edit_patient->setObjectName("edit_patient");
|
||||
edit_patient->hide();
|
||||
edit_patient->hide();
|
||||
contentLayout->addWidget(edit_patient);
|
||||
|
||||
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();
|
||||
});
|
||||
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
|
||||
//select default row 0
|
||||
if (model->rowCount() > 0)
|
||||
{
|
||||
table->selectRow(0);
|
||||
@@ -143,7 +147,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
|
||||
@@ -161,15 +165,15 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
||||
});
|
||||
|
||||
connect(btnAdd, &QToolButton::clicked, [=]() {
|
||||
edit_patient->show();
|
||||
btnShowEdit->hide();
|
||||
edit_patient->show();
|
||||
btnShowEdit->hide();
|
||||
edit_patient->clearPatientInformation();
|
||||
edit_patient->setEditEnable(true);
|
||||
btnSelect->setEnabled(false);
|
||||
});
|
||||
connect(btnEdit, &QToolButton::clicked, [=]() {
|
||||
edit_patient->show();
|
||||
btnShowEdit->hide();
|
||||
edit_patient->show();
|
||||
btnShowEdit->hide();
|
||||
table->clicked(table->currentIndex());
|
||||
edit_patient->setEditEnable(true);
|
||||
btnSelect->setEnabled(false);
|
||||
@@ -242,8 +246,8 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
||||
}
|
||||
else {
|
||||
currentRow = -1;
|
||||
edit_patient->editCancel();
|
||||
edit_patient->clearPatientInformation();
|
||||
edit_patient->editCancel();
|
||||
edit_patient->clearPatientInformation();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user