qt: allow dragging, copying and saving QR code

Add context menu and drag handling to QR code widget.
This commit is contained in:
Wladimir J. van der Laan
2013-10-18 13:08:30 +02:00
parent 864a6f790e
commit 82095923bb
3 changed files with 75 additions and 13 deletions

View File

@@ -3,12 +3,32 @@
#include <QDialog>
#include <QImage>
#include <QLabel>
namespace Ui {
class ReceiveRequestDialog;
}
class OptionsModel;
/* Label widget for QR code. This image can be dragged, dropped, copied and saved
* to disk.
*/
class QRImageWidget : public QLabel
{
Q_OBJECT
public:
explicit QRImageWidget(QWidget *parent = 0);
QImage exportImage();
public slots:
void saveImage();
void copyImage();
protected:
virtual void mousePressEvent(QMouseEvent *event);
};
class ReceiveRequestDialog : public QDialog
{
Q_OBJECT
@@ -23,7 +43,6 @@ private slots:
void on_lnReqAmount_textChanged();
void on_lnLabel_textChanged();
void on_lnMessage_textChanged();
void on_btnSaveAs_clicked();
void updateDisplayUnit();
@@ -31,7 +50,6 @@ private:
Ui::ReceiveRequestDialog *ui;
OptionsModel *model;
QString address;
QImage myImage;
void genCode();
QString getURI();