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

}

}

相关推荐
LDR0066 天前
Type-C 快充全面升级!LDR6601 赋能个人护理便携电机,重塑剃须刀 / 理发器新体验
c语言·开发语言
雪碧聊技术6 天前
Tree.js是什么?一文讲透
开发语言·javascript·ecmascript
码云数智-园园6 天前
C++20 Modules 模块详解
java·开发语言·spring
swordbob6 天前
NIO的channel中什么是 fd(File Descriptor,文件描述符)
java·开发语言·nio
源分享6 天前
Java线程同步的多种实现方法(非常详细)
java·开发语言·jvm
Luminous.6 天前
C语言--day30
c语言·开发语言
何以解忧,唯有..6 天前
Go语言循环语句详解:for、range与循环控制
开发语言·算法·golang
謓泽6 天前
C语言不是语法,是通往机器的地图。
c语言·开发语言
云水一下6 天前
从零开始学 PHP 系列(一):PHP 的前世今生与开发环境搭建
开发语言·php
飞天狗1116 天前
零基础JavaWeb入门——第五课第二小节:九大内置对象 · 第2个:response(响应对象)
java·开发语言