52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
#include <qdialog.h>
|
|
#include <qlineedit.h>
|
|
#include <qlayout.h>
|
|
#include <qpushbutton.h>
|
|
#include <qlabel.h>
|
|
#include <qdebug.h>
|
|
#include "fancyDialog.h"
|
|
#include"fancyButton.h"
|
|
class enterPasswdWindow : public fancyDialog
|
|
{
|
|
Q_OBJECT
|
|
public :
|
|
std::string passwd = "EXE";
|
|
QLineEdit passwordLine;
|
|
fancyButtonText okBtn;
|
|
enterPasswdWindow():
|
|
fancyDialog("ÇëÊäÈëÃÜÂë","",false),
|
|
okBtn(120,60,"È·ÈÏ","È·ÈÏ")
|
|
{
|
|
init();
|
|
QFont font2("΢ÈíÑźÚ", 18, QFont::Bold);;
|
|
this->funcBtnLayout->addWidget(&passwordLine);
|
|
passwordLine.setFont(font2);
|
|
QHBoxLayout* btnLayout = new QHBoxLayout();
|
|
btnLayout->addWidget(&okBtn);
|
|
this->funcBtnLayout->addLayout(btnLayout);
|
|
QObject::connect(&okBtn, &QPushButton::clicked, this, [=]() {verifyPasswd(passwordLine.text().toStdString()); });
|
|
}
|
|
void init()
|
|
{
|
|
passwordLine.clear();
|
|
this->detailLabel->setText("");
|
|
}
|
|
void verifyPasswd(std::string passwd)
|
|
{
|
|
if (!passwd.compare("EVE"))
|
|
{
|
|
emit okSignal();
|
|
qDebug() << "ÃÜÂëÕýÈ·" << QString::fromStdString(passwd);
|
|
this->hide();
|
|
this->init();
|
|
return;
|
|
}
|
|
this->detailLabel->setText("ÃÜÂë´íÎó");
|
|
qDebug() << "ÃÜÂë´íÎó" << QString::fromStdString(passwd);
|
|
emit ngSignal();
|
|
}
|
|
signals:
|
|
void okSignal();
|
|
void ngSignal();
|
|
};
|
|
#pragma once |