Auto select first row of patient tableView.

This commit is contained in:
krad
2021-10-21 14:18:58 +08:00
parent 79ca8d8ee9
commit fecbcea38c

View File

@@ -80,6 +80,7 @@ SelectFormWidget::SelectFormWidget(QWidget *parent) :
table->setColumnWidth(2,250);
table->setColumnWidth(3,120);
table->setColumnWidth(4,60);
contentLayout->addWidget(table);
QWidget* spacerLine2= new QWidget(this);
spacerLine2->setFixedWidth(2);
@@ -89,7 +90,18 @@ SelectFormWidget::SelectFormWidget(QWidget *parent) :
EditPatientForm* edit_patient= new EditPatientForm(this);
edit_patient->setObjectName("edit_patient");
contentLayout->addWidget(edit_patient);
//select default row 0
if (model->rowCount()>0)
{
table->selectRow(0);
currentRow=0;
PatientInformation pat;
#define ADD_PATIENT_PROPERTY(val)\
pat. val = model->data(model->index(currentRow,PatientInformationEnum:: val)).toString();
EDIT_PATIENT()
#undef ADD_PATIENT_PROPERTY
edit_patient->setPatientInformation(&pat);
}
//events----------------------------------------------------------------------
//table current row selection changing event
connect(table,&QTableView::clicked,[=](const QModelIndex & modelIndex){