-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquerytable.cpp
More file actions
110 lines (92 loc) · 2.88 KB
/
querytable.cpp
File metadata and controls
110 lines (92 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include "querytable.h"
#include "ui_querytableform.h"
#include "querydata.h"
#include <QDebug>
queryTable::queryTable(QWidget *parent) :
QWidget(parent),
ui(new Ui::queryTable)
{
ui->setupUi(this);
}
bool queryTable::SetPatientName(QList<QString> Patient)
{
QueryPatientName= Patient;
if (QueryPatientName.isEmpty())
return false ;
return true;
}
bool queryTable::setPatientID(QList<QString> PatientID)
{
QueryPatientID = PatientID;
if (QueryPatientID.isEmpty())
return false;
return true;
}
bool queryTable::setAccessionNumber(QList<QString> AccessionNumber)
{
QueryAccessionNumber= AccessionNumber;
if (QueryAccessionNumber.isEmpty())
return false;
return true;
}
void queryTable::writeDataTableSpace()
{
for(int i=0;i<QueryPatientName.size();i++){
QueryData *data = new QueryData();
data->PatientName= QueryPatientName.at(i);
data->PatientID= QueryPatientID.at(i);
data->AccessionNumber= QueryAccessionNumber.at(i);
model->list.append(data);
}
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
connect (ui->tableView,SIGNAL(clicked(QModelIndex)),this,SLOT(onClicked(QModelIndex)));
connect(ui->pushButtonSearch,SIGNAL(clicked()),this,SLOT(ClickedFilterQuery()));
connect(ui->getPatientfromServer,SIGNAL(clicked()),this,SLOT(CgetPatient()));
proxyModel = new QSortFilterProxyModel(this);
proxyModel->setSourceModel(model);
ui->tableView->setModel(proxyModel);
}
queryTable::~queryTable()
{
delete ui;
}
void queryTable::onClicked(QModelIndex index)
{
qDebug() << model->list.at(index.row())->PatientName;
}
void queryTable::ClickedFilterQuery()
{
bool setFilter=false;
if (!ui->searchLinePatientName->text().isEmpty()){
QString UrlSearch("^");
UrlSearch.append(ui->searchLinePatientName->text());
QRegExp Regex(UrlSearch);
proxyModel->setFilterRegExp(Regex);
proxyModel->setFilterKeyColumn(0);
setFilter = true;
}
if (!ui->searchLinePatientID->text().isEmpty()){
QString UrlSearch("^");
UrlSearch.append(ui->searchLinePatientID->text());
qDebug() << UrlSearch;
QRegExp Regex(UrlSearch);
proxyModel->setFilterRegExp(Regex);
proxyModel->setFilterKeyColumn(1);
setFilter = true;
}
if (!ui->searchLineAccessionNumber->text().isEmpty()){
QString UrlSearch("^");
UrlSearch.append(ui->searchLineAccessionNumber->text());
QRegExp Regex(UrlSearch);
proxyModel->setFilterRegExp(Regex);
proxyModel->setFilterKeyColumn(2);
setFilter = true;
}
if (!setFilter)
proxyModel->setFilterRegExp("");
}
void queryTable::CgetPatient()
{
}