This repository was archived by the owner on Jul 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
57 lines (43 loc) · 1.5 KB
/
mainwindow.cpp
File metadata and controls
57 lines (43 loc) · 1.5 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
#include "mainwindow.h"
#include <QFile>
#include <QHBoxLayout>
#include <QMessageBox>
#include <QString>
#include <QVBoxLayout>
#include "./model/item.h"
#include "./widget/editpagewidget.h"
#include "./widget/listitemwidget.h"
MainWindow::MainWindow(QWidget* parent) : QWidget(parent),
mainLayout(new QVBoxLayout(this)),
layout(new QHBoxLayout()),
listItems(new ListItemWidget()),
editPage(new EditPageWidget()) {
QFile file(":/resource/style.css");
file.open(QFile::ReadOnly);
QString style = QLatin1String(file.readAll());
setStyleSheet(style);
mainLayout->setMargin(0);
mainLayout->setSpacing(0);
layout->setMargin(0);
mainLayout->addLayout(layout);
layout->addWidget(listItems);
layout->addWidget(editPage);
layout->setStretch(0, 3);
layout->setStretch(1, 2);
setMinimumSize(QSize(640, 640));
setWindowTitle("QTo-do");
}
ListItemWidget* MainWindow::getListItemWidget() const {
return listItems;
}
EditPageWidget* MainWindow::getEditPageWidget() const {
return editPage;
}
void MainWindow::onReminderDialog(QString title_, QDate date_) {
QMessageBox msgBox;
msgBox.setWindowTitle("Reminder expired");
msgBox.setText(title_ + " is expired" + (date_ == QDate::currentDate() ? " today" : " " + QString::number(date_.daysTo(QDate::currentDate())) + " days ago"));
msgBox.exec();
}
MainWindow::~MainWindow() {
}