一、效果图
二、代码
#ifndef QRGENERATE_H
#define QRGENERATE_H
#include <QWidget>
#include "qrencode.h"
namespace Ui {
class QRgenerate;
}
class QRwidget : public QWidget
{
Q_OBJECT
public:
explicit QRwidget(QWidget *parent = nullptr);
~QRwidget();
void paintEvent(QPaintEvent *ev);
void SetData(const char *pData);
void setColor(QString backColor,QString beforeColor);
private:
unsigned char* mRQData;
int mWidth;
QString m_backColor;
QString m_beforeColor;
};
class QRgenerate : public QWidget
{
Q_OBJECT
public:
explicit QRgenerate(QWidget *parent = nullptr);
~QRgenerate();
private slots:
void on_pushButton_clicked();
private:
Ui::QRgenerate *ui;
};
#endif // QRGENERATE_H
#include "qrgenerate.h"