QT

#include "widget.h"

#include "ui_widget.h"

Widget::Widget(QWidget *parent)

: QWidget(parent)

, ui(new Ui::Widget)

,Gcancle(new QPushButton("取消",this))

,EmmEdit(new QLineEdit(this))

{

ui->setupUi(this);

ui->ALogo->setPixmap(QPixmap("://pic//th.jpg"));

ui->ALogo->setScaledContents((true));

ui->Bzhanghao->setPixmap(QPixmap(":/pic/wodepeizhenshi.png"));

ui->Bzhanghao->setScaledContents((true));

ui->Cmima->setPixmap(QPixmap("://pic//passwd.jpg"));

ui->Cmima->setScaledContents((true));

Gcancle->resize(ui->Flogin->width(),ui->Flogin->height());

Gcancle->move(ui->Flogin->x()+ui->Flogin->width()+15,ui->Flogin->y());

connect(Gcancle,SIGNAL(clicked()),this,SLOT(my_slot1()));

this->EmmEdit->resize(ui->DzhEdit->width(),ui->DzhEdit->height());

this->EmmEdit->move(ui->DzhEdit->x(),ui->DzhEdit->y()+ui->DzhEdit->height()+12);

connect(this->EmmEdit,SIGNAL(clicked()),this,SLOT(my_slot2()));

this->EmmEdit->setEchoMode(QLineEdit::Password);

}

Widget::~Widget()

{

delete ui;

}

void Widget::my_slot1()

{

this->close();

}

void Widget::my_slot2()

{

QString zh = ui->DzhEdit->text();

QString mm = this->EmmEdit->text();

if(zh == "admin" && mm == "123456")

{

QMessageBox::information(this, "登录", "登陆成功");

this->close();

}else

{

QMessageBox::warning(this, "登录", "登录失败");

ui->DzhEdit->clear();

this->EmmEdit->clear();

}

}

相关推荐
Themberfue7 分钟前
Redis ⑦-set | Zset
java·开发语言·数据库·redis·sql·缓存
__lost1 小时前
MATLAB画出3d的常见复杂有机分子和矿物的分子结构
开发语言·人工智能·matlab·化学·分子结构
夜夜敲码2 小时前
C语言教程(十八):C 语言共用体详解
c语言·开发语言
大学生亨亨3 小时前
go语言八股文(五)
开发语言·笔记·golang
raoxiaoya3 小时前
同时安装多个版本的golang
开发语言·后端·golang
cloues break.4 小时前
C++进阶----多态
开发语言·c++
我不会编程5554 小时前
Python Cookbook-6.10 保留对被绑定方法的引用且支持垃圾回收
开发语言·python
道剑剑非道4 小时前
QT开发技术【qcustomplot 曲线与鼠标十字功能】
开发语言·qt·计算机外设
刘婉晴5 小时前
【环境配置】Mac电脑安装运行R语言教程 2025年
开发语言·macos·r语言
Despacito0o5 小时前
C++核心编程:类与对象全面解析
开发语言·c++