2015-03-07 20:40:45 +08:00
|
|
|
#ifndef QRWIDGET_H
|
|
|
|
#define QRWIDGET_H
|
|
|
|
|
|
|
|
// https://stackoverflow.com/questions/21400254/how-to-draw-a-qr-code-with-qt-in-native-c-c
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
class QRWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2015-03-17 03:53:35 +08:00
|
|
|
|
2015-03-07 20:40:45 +08:00
|
|
|
public:
|
|
|
|
explicit QRWidget(QWidget *parent = 0);
|
2015-03-17 03:53:35 +08:00
|
|
|
void setQRData(const QString& data);
|
2015-03-08 22:20:15 +08:00
|
|
|
QImage* getImage();
|
2015-03-17 03:53:35 +08:00
|
|
|
bool saveImage(QString path);
|
|
|
|
|
2015-03-07 20:40:45 +08:00
|
|
|
private:
|
|
|
|
QString data;
|
|
|
|
void paintImage();
|
2015-03-17 03:53:35 +08:00
|
|
|
QImage* image;
|
2015-03-07 20:40:45 +08:00
|
|
|
QSize size;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // QRWIDGET_H
|