-
Notifications
You must be signed in to change notification settings - Fork 1
/
resetwin.cpp
103 lines (90 loc) · 3.18 KB
/
resetwin.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
#include "resetwin.h"
#include <QGraphicsView>
#include <QHBoxLayout>
#include <QStackedWidget>
#include <QVBoxLayout>
#include<QPixmap>
#include<QBrush>
#include<QPalette>
#include<QColor>
#include<QMessageBox>
#include"ElaPushButton.h"
#include"ElaText.h"
#include"ElaImageCard.h"
#include"ElaInteractiveCard.h"
resetwin::resetwin(QWidget* parent):ElaWidget(parent,400,500)
{
this->setWindowButtonFlag(ElaAppBarType::MaximizeButtonHint,false);
this->setWindowButtonFlag(ElaAppBarType::StayTopButtonHint,false);
setWindowTitle("珞珈云");
QWidget*area=new QWidget();
this->setWindowModality(Qt::ApplicationModal);
this->setCentralWidget(area);
this->hide();
this->setFixedSize(250,600);
this->setWindowFlags(Qt::WindowMinimizeButtonHint);
ElaText*text=new ElaText("重置密码");
text->setTextSize(20);
QHBoxLayout*textArea=new QHBoxLayout();
textArea->addWidget(text,0,Qt::AlignCenter);
ElaInteractiveCard*avatar=new ElaInteractiveCard();
avatar->setFixedSize(150,150);
avatar->setCardPixmapSize(140,140);
avatar->setCardPixmapBorderRadius(70);
QPixmap image(":/include/Image/Cirno.jpg");
avatar->setCardPixmap(image);
avatarArea=new QHBoxLayout();
avatarArea->addWidget(avatar,0,Qt::AlignCenter);
passwordLine=new ElaLineEdit();
passwordLine->setFixedSize(270,30);
passwordLine->setPlaceholderText("密码");
passwordLine->setEchoMode(QLineEdit::Password);
QHBoxLayout*passwordArea=new QHBoxLayout();
passwordArea->addWidget(passwordLine,0,Qt::AlignCenter);
passagainLine=new ElaLineEdit();
passagainLine->setFixedSize(270,30);
passagainLine->setPlaceholderText("再次确认密码");
passagainLine->setEchoMode(QLineEdit::Password);
QHBoxLayout*passagainArea=new QHBoxLayout();
passagainArea->addWidget(passagainLine,0,Qt::AlignCenter);
ElaPushButton*resetBtn=new ElaPushButton("重置");
resetBtn->setFixedSize(270,30);
resetBtn->setStyleSheet("background-color:rgb(0,204,255)");
QHBoxLayout*resetBtnArea=new QHBoxLayout();
resetBtnArea->addWidget(resetBtn,0,Qt::AlignCenter);
QVBoxLayout*resetWinArea=new QVBoxLayout(area);
resetWinArea->addLayout(textArea,Qt::AlignCenter);
resetWinArea->addLayout(avatarArea,Qt::AlignCenter);
resetWinArea->addLayout(passwordArea,Qt::AlignCenter);
resetWinArea->addLayout(passagainArea,Qt::AlignCenter);
resetWinArea->addLayout(resetBtnArea,Qt::AlignCenter);
area->setLayout(resetWinArea);
connect(resetBtn,&ElaPushButton::clicked,this, &resetwin::on_resetBtn_clicked);
}
void resetwin::on_resetBtn_clicked()
{
if(passwordLine->text()=="")
{
QMessageBox::information(this, "错误","请输入新密码!");
}
else if(passagainLine->text()=="")
{
QMessageBox::information(this, "错误","请再次确认密码!");
}
else if(passwordLine->text()!=passagainLine->text())
{
QMessageBox::information(this, "错误","两次输入的密码不一致!");
}
else
{
QMessageBox::information(this, "成功","重置成功");
emit goback();
}
}
resetwin::~resetwin()
{
}
void resetwin::closeEvent(QCloseEvent *event)
{
emit goback();
}