-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfinalwindow.cpp
More file actions
48 lines (44 loc) · 1.33 KB
/
finalwindow.cpp
File metadata and controls
48 lines (44 loc) · 1.33 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
#include "finalwindow.h"
#include "ui_finalwindow.h"
#include "iostream"
#include"qdebug.h"
#include <QCloseEvent>
FinalWindow::FinalWindow(QWidget *parent) :
QWidget(parent),
ui(new Ui::FinalWindow)
{
ui->setupUi(this);
QWidget::setFixedSize(580, 350);
this->interactor = &(MainWindowInteractor::getInstance());
QList<QList<QString>> tmp = interactor->getBouquetInfo();
foreach (auto i, tmp){
ui->listWidget->addItem(QString("Flour: ") + i[0] + QString("\nColor: ")
+ i[1] + QString("\nPrice: ") + i[2]);
}
ui->price->setText(QString::number(this->interactor->getTempBouquetPrice()));
}
FinalWindow::~FinalWindow()
{
delete ui;
}
void FinalWindow::on_endButton_clicked(){
this->interactor->clearTempBouquet();
emit this->endClicked();
this->destroy();
}
void FinalWindow::on_changeButton_clicked(){
emit this->endClicked();
this->destroy();
}
void FinalWindow::closeEvent(QCloseEvent *event){
emit this->endClicked();
event->accept();
}
void FinalWindow::on_listWidget_itemDoubleClicked(QListWidgetItem *item)
{
QStringList text = item->text().split("\n");
this->interactor->deleteFlourInTempBouquet(text[0].split(" ")[1],
text[1].split(" ")[1]);
delete item;
ui->price->setText(QString::number(this->interactor->getTempBouquetPrice()));
}