QT 小项目:登录注册账号和忘记密码(下一章实现远程登录数据库功能)

一、环境搭建
参考上一章环境
二、项目工程目录
在这里插入图片描述
三、主要源程序如下:
registeraccountwindow.cpp
窗口初始化:

void registeraccountWindow::reginit()
{
   
    //去掉?号
    this->setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    //更改名称
    this->setWindowTitle("register");
    //更换左上角图标
    this->setWindowIcon(QIcon(":/image/logol.png"));//生成窗口图标
    //禁止改变窗口大小 固定大小
    this->setFixedSize(408,270);
    //设置样式
    ui->lineEdit_registeraccount->setStyleSheet("QLineEdit{border-width:1px;border-radius:4px;font-size:12px;color:black;border:1px solid gray;}"
           "QLineEdit:hover{border-width:1px;border-radius:4px;font-size:16px;color:black;border:1px solid rgb(204,38,200);}");//边框宽度 边框圆角 字体大小 ...   选中边框颜色
    ui->lineEdit_registerpassword->setStyleSheet("QLineEdit{border-width:1px;border-radius:4px;font-size:12px;color:black;border:1px solid gray;}"
           "QLineEdit:hover{border-width:1px;border-radius:4px;font-size:12px;color:black;border:1px solid rgb(70,200,50);}");
    ui->lineEdit_regosterpassword_ok->setStyleSheet("QLineEdit{border-width:1px;border-radius:4px;font-size:12px;color:black;border:1px solid gray;}"
           "QLineEdit:hover{border-width:1px;border-radius:4px;font-size:12px;color:black;border:1px solid rgb(0,18,154);}");
    //设置密码框-密文登录
    ui->lineEdit_registerpassword->setEchoMode(QLineEdit::Password);
    ui->lineEdit_regosterpassword_ok->setEchoMode(QLineEdit::Password);
    //密码的隐藏和显示
    // 设置样式表(图片为眼睛样式)
    ui->checkBox_eye1->setStyleSheet("QCheckBox {spacing: 5px;border: none;background-color: transparent;}"
    "QCheckBox::indicator {width: 20px;height: 20px;border: none;image: url(:/image/close_eye.png);}"
    "QCheckBox::indicator:checked {image: url(:/image/open_eye.png);}");
    ui->checkBox_eye2->setStyleSheet("QCheckBox {spacing: 5px;border: none;background-color: transparent;}"
    "QCheckBox::indicator {width: 20px;height: 20px;border: none;image: url(:/image/close_eye.png);}"
    "QCheckBox::indicator:checked {image: url(:/image/open_eye.png);}");
    //提示信息
    ui->lineEdit_registeraccount->setPlaceholderText("请输入设置的用户名 格式10位以内的数字");
    ui->lineEdit_registerpassword->setPlaceholderText("请输入设置的密码 格式15位以内的数字") ;
    ui->lineEdit_regosterpassword_ok->setPlaceholderText("请再次输入设置的密码 格式15位以内的数字");
    ui->lineEdit_checkcode->setPlaceholderText("请输入验证码");
    //返回主界面按钮样式  背景透明等
    ui->pushButton_back->setStyleSheet("QPushButton {"
                                                  "  background-color: transparent;"
                                                  "  border: none;"
                                                  "  color:rgb(255, 255, 255)"
                                                  "}"
                                                  "QPushButton:hover{color:rgb(15, 23, 253)}"
                                                  "QPushButton:pressed{color:rgb(255, 44, 221)}"
                                                  );
     //验证码按键样式
     ui->pushButton_checkcode->setStyleSheet("QPushButton {"
                                           "  background-color: transparent;"
                                           "  border: none;"
                                           "}"
                                           "Q
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

憨憨是你。。。。

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值