Qt day4

思维导图:

作业:

cpp 复制代码
#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);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    if(ui->lineEdit->text() == "admin" && ui->lineEdit_2->text() == "123")
    {
        QMessageBox msg(
                    QMessageBox::Information,
                    "提示",
                    "登录成功",
                    QMessageBox::Yes,
                    this);

        msg.exec();
        this->close();
        emit my_jump();
    }
    else
    {
        int ret = QMessageBox::critical(
                    this,
                    "登录失败",
                    "账号密码不匹配",
                    QMessageBox::Yes | QMessageBox::No);

        if(ret == QMessageBox::Yes)
        {
            ui->lineEdit_2->clear();
        }
        else
        {
            this->close();
        }
    }
}

void Widget::on_pushButton_2_clicked()
{
    int ret = QMessageBox::question(
                this,
                "?",
                "退出登录?",
                QMessageBox::Yes | QMessageBox::No);

    if(ret == QMessageBox::Yes)
    {
        this->close();
    }
}
相关推荐
惊讶的猫2 小时前
工具选对之后还不够:商城 Agent 的参数与权限治理
开发语言·python
cmpxr_2 小时前
【MicroPython】如何刷新ESP8266的固件
开发语言·micropython
搭贝3 小时前
上厕所的时间搭好一套系统:AI自动生成实测
开发语言·人工智能·低代码·ai·php·搭贝
智感子3 小时前
智能称重·数据上云:从仪表读数到可追溯的计量凭证
开发语言·php
\光辉岁月/3 小时前
7.javase-面向对象
java·开发语言
weixin_531094693 小时前
heap_4内存管理
java·开发语言·算法
疯狂的维修3 小时前
关于用C#写电机起保停控制
开发语言·c#
geovindu5 小时前
rust: Abstract Factory pattern
开发语言·后端·设计模式·rust·抽象工厂模式
“AI国潮设计-小江”5 小时前
《Python+SDXL实战:用ControlNet批量生成“英歌舞麻将糕”IP,附自动化脚本与商用思路》
开发语言·人工智能·python·prompt·aigc
Cc.Y5 小时前
Java零基础入门:封装与继承 —— 从“裸奔“到“穿衣服“,从“重复造轮子“到“站在巨人肩膀上“
java·开发语言