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();

}

}

相关推荐
Mr.Jessy6 分钟前
Web APIs 学习第六天:BOM、location对象与本地存储
开发语言·前端·javascript·学习·web api·bom
LIZhang201621 分钟前
基于ffmpeg8.0录制mp4文件
开发语言·c++
_OP_CHEN29 分钟前
C++进阶:(九)深度剖析unordered_map 与 unordered_set容器
开发语言·c++·stl容器·哈希表·哈希桶·unordered_map·unordered_set
七夜zippoe30 分钟前
Java并发编程基石:深入理解JMM(Java内存模型)与Happens-Before规则
java·开发语言·spring·jmm·happens-before
Mark Studio42 分钟前
QT linux 静态编译问题记录
开发语言·qt
无敌最俊朗@1 小时前
C++-Qt-音视频-基础问题01
开发语言·c++
kyle~1 小时前
C++---万能指针 void* (不绑定具体数据类型,能指向任意类型的内存地址)
开发语言·c++
MediaTea2 小时前
Python 第三方库:TensorFlow(深度学习框架)
开发语言·人工智能·python·深度学习·tensorflow
vortex52 小时前
Bash Glob 通配符详细指南:从 POSIX 标准到高级用法
开发语言·bash
KdanMin2 小时前
Android MediaCodec 硬编解码实战:从Camera预览到H264流与回环渲染
android·开发语言