-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
91 lines (78 loc) · 2.17 KB
/
Copy pathmainwindow.cpp
File metadata and controls
91 lines (78 loc) · 2.17 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
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->editNombreLista->hide();
ui->guardarListabtn->hide();
layout = new QHBoxLayout;
layout->setAlignment(Qt::AlignTop);
QScrollArea *scroll = new QScrollArea;
ui->frame->setParent(scroll);
ui->frame->setLayout(layout);
scroll->setWidget(ui->frame);
scroll->setWidgetResizable(true);
QLayout* outerLayout = new QVBoxLayout();
outerLayout->addWidget(scroll);
ui->frame2->setLayout(outerLayout);
setWindowTitle(QObject::tr("MiTrello"));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::mostrar(Board* b)
{
currentBoard = b;
ui->lblNombre->setText(b->text());
b->lista->iteradorReset();
while(!b->lista->iteradorEnd())
{
layout->addWidget(b->lista->valorIterador());
b->lista->Siguiente();
}
show();
}
void MainWindow::closeEvent (QCloseEvent *event)
{
QMessageBox::StandardButton resBtn = QMessageBox::question( this, "Seguro",
tr("Estas seguro?\n"),
QMessageBox::Cancel | QMessageBox::No | QMessageBox::Yes,
QMessageBox::Yes);
if (resBtn != QMessageBox::Yes) {
event->ignore();
} else {
while(!layout->isEmpty())
{
delete layout->itemAt(0)->widget();
}
event->accept();
}
}
void MainWindow::on_pushButton_clicked()
{
ui->editNombreLista->show();
ui->guardarListabtn->show();
}
void MainWindow::on_guardarListabtn_clicked()
{
QString n = ui->editNombreLista->text();
if(!n.isEmpty())
addList(n);
ui->editNombreLista->clear();
ui->guardarListabtn->hide();
ui->editNombreLista->hide();
}
void MainWindow::addList(QString nombre)
{
ListaTarjeta* l = new ListaTarjeta(nombre);
l->updateList();
currentBoard->lista->Agregar(l);
layout->addWidget(l);
}
void MainWindow::on_pushButton_2_clicked()
{
emit guardarClick();
}