mirror of
https://gitee.com/Zhaoxin59/my-chat_-client.git
synced 2026-02-14 00:51:48 +08:00
has been completed.
This commit is contained in:
32
verifycodewidget.h
Normal file
32
verifycodewidget.h
Normal file
@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QRandomGenerator>
|
||||
|
||||
class VerifyCodeWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VerifyCodeWidget(QWidget *parent = nullptr);
|
||||
|
||||
//通过这个函数生成随机的验证码字符串
|
||||
QString generateVerifyCode();
|
||||
|
||||
//刷新并把当前验证码显示到界面上
|
||||
void refreshVerifyCode();
|
||||
|
||||
//检验验证码是否匹配
|
||||
bool checkVerifyCode(const QString& verifyCode);
|
||||
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
|
||||
private:
|
||||
//随机数生成器
|
||||
QRandomGenerator randomGenerator;
|
||||
|
||||
//保存验证码的值
|
||||
QString verifyCode = "";
|
||||
signals:
|
||||
};
|
||||
Reference in New Issue
Block a user