forked from KamelMoohamed/CMP2241_F21_Team01_IRO_Painting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
welcomewindow.cpp
59 lines (53 loc) · 1.57 KB
/
welcomewindow.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
56
57
58
#include "welcomewindow.h"
#include "ui_welcomewindow.h"
#include <QFileDialog>
WelcomeWindow::WelcomeWindow(QWidget *parent) :
QMainWindow(parent, Qt::FramelessWindowHint | Qt::WindowSystemMenuHint),
ui(new Ui::WelcomeWindow)
{
ui->setupUi(this);
setAttribute(Qt::WA_TranslucentBackground);
QString cs1="QPushButton {"
"background-color: black;"
"color: white;"
"border-radius: 13px;"
"}"
"QPushButton:hover {"
"color:#fd369e ;"
"}"
"QPushButton:pressed {"
"color:red ;"
"}";
ui->newPaintBtn->setStyleSheet(cs1);
ui->openPaintBtn->setStyleSheet(cs1);
}
WelcomeWindow::~WelcomeWindow()
{
delete ui;
}
/*
* --------------------New button----------------------
* Once clicked, it initialize a new window (Paint Window)
* and open it, then hide the current
*/
void WelcomeWindow::on_newPaintBtn_clicked()
{
p->show();
this->hide();
}
/*
* --------------------Open button--------------------
* Opening Dialog and getting the path from it
* Then pass the path to (open function) in the scene.
*/
void WelcomeWindow::on_openPaintBtn_clicked()
{
QString path = QFileDialog::getOpenFileName(this, tr("Open File"),
QDir::homePath() + "/Documents/IRO Arts",
tr("JSON (*.json)"));
if (!path.isNull()){
p->show();
this->hide();
p->open(path);
}
}