#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,
"登錄成功!",
"將跳轉(zhuǎn)下一個頁面..",
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){
}
}
}
}
文章來源地址http://www.zghlxwxcb.cn/news/detail-816341.html
文章來源:http://www.zghlxwxcb.cn/news/detail-816341.html
到了這里,關(guān)于qt圖形化界面開發(fā)DAY4的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!