forked from 3rd-year-CSE-20/SIS_GUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.cpp
115 lines (98 loc) · 3.94 KB
/
login.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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include "login.h"
Login::Login(QWidget *parent):QWidget(parent){
usrEdit = new QLineEdit("");
passEdit = new QLineEdit("");
_mainLayout = new QHBoxLayout();
_leftLayout = new QVBoxLayout();
_leftWidget = new QWidget();
_rightWidget = new QWidget();
_rightLayout = new QVBoxLayout();
container = new QWidget();
mainLayout = new QHBoxLayout();
img = new QLabel();
login = new QLabel(" Login");
loginBtn = new QPushButton("Login");
img->setPixmap(QPixmap("login.png"));
forgetLbl = new ClickableLabel();
regBtn = new QPushButton("Create Account");
errLbl = new QLabel("Try again Wrong Id or Password");
errLbl->setStyleSheet("color: red; font 12px;");
errLbl->setVisible(false);
// emit test();
this->setLayout(_mainLayout);
this->setStyleSheet("background-color:white; border-radius : 10px;");
_mainLayout->addWidget(container);
container->setLayout(mainLayout);
mainLayout->addWidget(_leftWidget);
mainLayout->addWidget(_rightWidget);
mainLayout->setSpacing(0);
QWidget *t = new QWidget();
QHBoxLayout *tLay = new QHBoxLayout();
t->setLayout(tLay);
tLay->addWidget(new QWidget);
tLay->addWidget(regBtn);
tLay->addWidget(new QWidget);
_leftWidget->setLayout(_leftLayout);
_leftLayout->addWidget(new QWidget);
_leftLayout->addWidget(img);
_leftLayout->addWidget(t);
_leftLayout->addWidget(new QWidget);
QWidget *s0 = new QWidget;
s0->setMinimumHeight(170);
QWidget *s1 = new QWidget;
s1->setMaximumHeight(20);
QWidget *s2 = new QWidget;
s2->setMaximumHeight(20);
QWidget *s3 = new QWidget;
s3->setMaximumHeight(5);
_rightWidget->setLayout(_rightLayout);
login->setMaximumHeight(50);
_rightLayout->addWidget(s0);
_rightLayout->addWidget(login);
_rightLayout->addWidget(s1);
_rightLayout->addWidget(errLbl);
_rightLayout->addWidget(usrEdit);
_rightLayout->addWidget(passEdit);
_rightLayout->addWidget(s2);
_rightLayout->addWidget(loginBtn);
_rightLayout->addWidget(s3);
_rightLayout->addWidget(forgetLbl);
_rightLayout->addWidget(new QWidget);
// _rightLayout->setSpacing(20);
forgetLbl->setText("\t\t\tForget Password");
forgetLbl->setAlignment(Qt::AlignTop);
QFont f("Arial",30,10);
login->setFont(f);
usrEdit->setMinimumHeight(40);
usrEdit->setMaximumWidth(260);
usrEdit->setStyleSheet("background : #E6E6E6; border-radius : 20px; padding : 7px");
usrEdit->setPlaceholderText(" ID");
passEdit->setMinimumHeight(40);
passEdit->setMaximumWidth(260);
passEdit->setStyleSheet("background : #E6E6E6; border-radius : 20px; padding : 7px");
passEdit->setPlaceholderText(" Password");
passEdit->setEchoMode(QLineEdit::Password);
loginBtn->setStyleSheet(QString("QPushButton#login{border-radius : 20px; padding : 7px; color : white; font-weight: bold;}")+
"QPushButton#login{ background : #00c941;}"+
"QPushButton:hover#login{ background : #333333;}");
loginBtn->setMinimumHeight(40);
loginBtn->setMaximumWidth(260);
loginBtn->setObjectName("login");
regBtn->setStyleSheet(QString("QPushButton#login{border-radius : 20px; padding : 7px; color : white; font-weight: bold;}")+
"QPushButton#login{ background : red;}"+
"QPushButton:hover#login{ background : #333333;}");
regBtn->setMinimumHeight(40);
regBtn->setMaximumWidth(260);
regBtn->setObjectName("login");
this->setMinimumHeight(650);
this->setMinimumWidth(900);
this->setMaximumWidth(900);
connect(regBtn,SIGNAL(clicked()),this,SLOT(onRegisterClicked()));
connect(loginBtn, SIGNAL(clicked()),this,SLOT(onLoginClicked()));
}
void Login::onLoginClicked(){
emit LoginAcc(usrEdit->text(),passEdit->text());
}
void Login::onRegisterClicked(){
emit Register();
}