#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
this->setWindowFlag(Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground);
this->setWindowIcon(QIcon(":/Logo/qq.jpg"));
ui->lineEdit_username->setText("admin");
ui->lineEdit_userpasswd->setText("123456");
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_pushButton_close_clicked()
{
this->close();
}
void Widget::on_pushButton_login_clicked()
{
QString name=ui->lineEdit_username->text();
QString passwd=ui->lineEdit_userpasswd->text();
if(name == "admin" && passwd == "123456"){
int ret = QMessageBox::information(this,
"登录成功!",
"将跳转下一个页面..",
QMessageBox::Ok |QMessageBox::No);
if(ret == QMessageBox::Ok){
this->close();
emit this->jump_alarm();
}
}else {
int ret = QMessageBox::critical(this,
"登录失败",
"账号密码不匹配,是否重新登录",
QMessageBox::Yes |QMessageBox::No);
if(ret == QMessageBox::Yes){
ui->lineEdit_username->clear();
ui->lineEdit_userpasswd->clear();
}else if(ret == QMessageBox::No){
int ret = QMessageBox::question(this,
"退出登录",
"您是否确定要退出登录",
QMessageBox::Yes |QMessageBox::No);
if(ret == QMessageBox::Yes){
this->close();
}else if(ret == QMessageBox::No){
}
}
}
}
文章来源地址https://www.toymoban.com/news/detail-816341.html
文章来源:https://www.toymoban.com/news/detail-816341.html
到了这里,关于qt图形化界面开发DAY4的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!