-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorderpage.cpp
45 lines (37 loc) · 1.34 KB
/
orderpage.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
#include "orderpage.h"
#include"common.h"
#include<QDebug>
orderpage::orderpage()
{
orders = new QScrollArea();
orderitems = new QWidget();
layoutitems = new QVBoxLayout();
scrollspacer = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Expanding);
//layoutitems->addWidget(new orderpageitem());
layoutitems->addSpacerItem(scrollspacer);
orderitems->setLayout(layoutitems);
orders->setWidget(orderitems);
orders->setWidgetResizable(true);
orders->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
mainlayout = new QVBoxLayout();
mainlayout->addWidget(orders);
this->setLayout(mainlayout);
}
void orderpage::addorder(QString name, QString time, QString status){
if(order_set.contains(name))return;
//3650599367aA
log_error("orderpage::addorder");
//std::cout<<name.toStdString().data()<<std::endl;
layoutitems->removeItem(scrollspacer);
orderpageitem* neworder = (new orderpageitem())->setvalues("#"+name,time,status);
layoutitems->addWidget(neworder);
layoutitems->addSpacerItem(scrollspacer);
order_set.insert(name,neworder);
//qDebug()<<order_set;
}
void orderpage::setstatus(QString id, QString status){
orderpageitem* target = order_set.value(id);
if(target){
target->setorderstatus(status);
}
}