-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchpanel.cpp
55 lines (45 loc) · 1.12 KB
/
searchpanel.cpp
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
#include "searchpanel.h"
#include "ui_searchpanel.h"
#include "product.h"
#include "clientpanel.h"
#include <QtDebug>
#include <QJsonArray>
searchpanel::searchpanel(QWidget *parent) :
QWidget(parent),
ui(new Ui::searchpanel)
{
ui->setupUi(this);
}
searchpanel::~searchpanel()
{
delete ui;
}
void searchpanel::on_backBtn_clicked()
{
this->close();
}
void searchpanel::on_searchBtn_clicked()
{
if(ui->searchText->text().length() > 0){
QString accordingTo;
switch (ui->accordingTo->currentIndex()) {
case 0:
accordingTo = "name";
break;
case 1:
accordingTo = "category";
break;
case 2:
accordingTo = "customer";
break;
case 3:
accordingTo = "brand";
break;
default:
accordingTo = "name";
}
QJsonArray searchResult = product::search(accordingTo,ui->searchText->text());
emit search_product(searchResult);
this->hide();
}
}