Qt day2

思维导图:

作业:

复制代码
#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
   QMovie *mov=new QMovie("E:\\1.QQ\\1774024653\\FileRecv\\pictrue\\qq.gif");
   ui->logol->setMovie(mov);
   mov->start();
   ui->logol->setScaledContents(1);

   ui->username_button->setPixmap(QPixmap(":/pictrue/login.png"));
   ui->username_button->setScaledContents(1);
   ui->passward_button->setPixmap(QPixmap(":/pictrue/passwd.jpg"));
   ui->passward_button->setScaledContents(1);

   ui->username_edit->setPlaceholderText("请输入用户名/注册");
   ui->username_edit->setEchoMode(QLineEdit::Normal);
   ui->passwardedit->setPlaceholderText("密码");
   ui->passwardedit->setEchoMode(QLineEdit::Password);

   connect(ui->loginbutton,SIGNAL(clicked()),this,SLOT(my_slot()));


}
void Widget::my_slot(){
    QString username=ui->username_edit->text();
    QString password=ui->passwardedit->text();
    if(username=="admin"&& password=="123456"){
//        qDebug()<<"登录成功";
       QMessageBox::information(this,"登录状态","登录成功");
        this->close();
    }else {
//            qDebug()<<"密码错误";
            QMessageBox::warning(this,"status","登录失败");
            ui->passwardedit->clear();


        }

    }


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


void Widget::on_cancel_button_clicked()
{
    this->close();
}
相关推荐
时间的情敌7 分钟前
Three.js 后处理辉光 Bloom、告警发光效果、管线流光、着色器流动管线(ShaderMaterial)
开发语言·javascript·three.js·着色器
Evand J18 分钟前
【CIR系列2】UWB视距(LOS)与非视距(NLOS)信道冲激响应(CIR)建模与对比,MATLAB
开发语言·matlab·信号处理·nlos·cir
风落青芜21 分钟前
C++入门:类和对象(二)
开发语言·数据结构·c++·算法
向科→向总工→空间动态计系统1 小时前
机器人大脑系统
开发语言·人工智能·python·机器人
一只QAQ1 小时前
c语言八股
c语言·开发语言
wuyk5551 小时前
AI 时代的嵌入式该怎么学-11-C不是语法是对内存的显式建模
c语言·开发语言·stm32·单片机·嵌入式硬件·mcu·算法
吃我一窝jio1 小时前
字节流与字符流深度解析
java·开发语言·笔记
风落青芜2 小时前
C++入门:类和对象(三)
开发语言·数据结构·c++·算法
AI2中文网2 小时前
App Inventor 做的表单怎么导出 PDF?WebViewer + JavaScript 在本地生成并保存 PDF 的完整示例
android·开发语言·javascript·pdf·鸿蒙·app inventor
野生技术架构师3 小时前
高级 Java 工程师面试八股(2026 精选版)
java·开发语言·面试