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

}

}

相关推荐
清水白石0082 小时前
Python 编程实战全景:从基础语法到插件架构、异步性能与工程最佳实践
开发语言·python·架构
Halo_tjn4 小时前
Java 基于字符串相关知识点
java·开发语言·算法
梦想的颜色4 小时前
java 利用redis来限制用户频繁点击
java·开发语言
报错小能手4 小时前
Swift 并发 Combine响应式框架
开发语言·ios·swift
万法若空5 小时前
C++ <memory> 库全方位详解
开发语言·c++
代码中介商5 小时前
C++ 类型转换深度解析:static_cast、dynamic_cast、const_cast、reinterpret_cast
开发语言·c++
青小莫5 小时前
C++之string(OJ练习)
开发语言·c++·stl
freshman_y5 小时前
一篇介绍C语言中二级指针和二维数组的文章
c语言·开发语言
-Marks-5 小时前
【C++编程】STL简介 --- (是什么 | 版本发展历程 | 六大组件 | 重要性缺陷以及如何学习)
开发语言·c++·学习·stl·stl版本