|
|
@ -16,6 +16,7 @@ |
|
|
|
#include <QMimeData> |
|
|
|
#include <QMimeData> |
|
|
|
#include <QMouseEvent> |
|
|
|
#include <QMouseEvent> |
|
|
|
#include <QPixmap> |
|
|
|
#include <QPixmap> |
|
|
|
|
|
|
|
#include <QMenu> |
|
|
|
#if QT_VERSION < 0x050000 |
|
|
|
#if QT_VERSION < 0x050000 |
|
|
|
#include <QUrl> |
|
|
|
#include <QUrl> |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -29,26 +30,27 @@ |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
QRImageWidget::QRImageWidget(QWidget *parent): |
|
|
|
QRImageWidget::QRImageWidget(QWidget *parent): |
|
|
|
QLabel(parent) |
|
|
|
QLabel(parent), contextMenu(0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
setContextMenuPolicy(Qt::ActionsContextMenu); |
|
|
|
contextMenu = new QMenu(); |
|
|
|
|
|
|
|
|
|
|
|
QAction *saveImageAction = new QAction(tr("&Save Image..."), this); |
|
|
|
QAction *saveImageAction = new QAction(tr("&Save Image..."), this); |
|
|
|
connect(saveImageAction, SIGNAL(triggered()), this, SLOT(saveImage())); |
|
|
|
connect(saveImageAction, SIGNAL(triggered()), this, SLOT(saveImage())); |
|
|
|
addAction(saveImageAction); |
|
|
|
contextMenu->addAction(saveImageAction); |
|
|
|
QAction *copyImageAction = new QAction(tr("&Copy Image"), this); |
|
|
|
QAction *copyImageAction = new QAction(tr("&Copy Image"), this); |
|
|
|
connect(copyImageAction, SIGNAL(triggered()), this, SLOT(copyImage())); |
|
|
|
connect(copyImageAction, SIGNAL(triggered()), this, SLOT(copyImage())); |
|
|
|
addAction(copyImageAction); |
|
|
|
contextMenu->addAction(copyImageAction); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QImage QRImageWidget::exportImage() |
|
|
|
QImage QRImageWidget::exportImage() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if(!pixmap()) |
|
|
|
|
|
|
|
return QImage(); |
|
|
|
return pixmap()->toImage().scaled(EXPORT_IMAGE_SIZE, EXPORT_IMAGE_SIZE); |
|
|
|
return pixmap()->toImage().scaled(EXPORT_IMAGE_SIZE, EXPORT_IMAGE_SIZE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QRImageWidget::mousePressEvent(QMouseEvent *event) |
|
|
|
void QRImageWidget::mousePressEvent(QMouseEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(event->button() == Qt::LeftButton) |
|
|
|
if(event->button() == Qt::LeftButton && pixmap()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
event->accept(); |
|
|
|
event->accept(); |
|
|
|
QMimeData *mimeData = new QMimeData; |
|
|
|
QMimeData *mimeData = new QMimeData; |
|
|
@ -64,6 +66,8 @@ void QRImageWidget::mousePressEvent(QMouseEvent *event) |
|
|
|
|
|
|
|
|
|
|
|
void QRImageWidget::saveImage() |
|
|
|
void QRImageWidget::saveImage() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if(!pixmap()) |
|
|
|
|
|
|
|
return; |
|
|
|
QString fn = GUIUtil::getSaveFileName(this, tr("Save QR Code"), QString(), tr("PNG Image (*.png)"), NULL); |
|
|
|
QString fn = GUIUtil::getSaveFileName(this, tr("Save QR Code"), QString(), tr("PNG Image (*.png)"), NULL); |
|
|
|
if (!fn.isEmpty()) |
|
|
|
if (!fn.isEmpty()) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -73,9 +77,18 @@ void QRImageWidget::saveImage() |
|
|
|
|
|
|
|
|
|
|
|
void QRImageWidget::copyImage() |
|
|
|
void QRImageWidget::copyImage() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if(!pixmap()) |
|
|
|
|
|
|
|
return; |
|
|
|
QApplication::clipboard()->setImage(exportImage()); |
|
|
|
QApplication::clipboard()->setImage(exportImage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QRImageWidget::contextMenuEvent(QContextMenuEvent *event) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(!pixmap()) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
contextMenu->exec(event->globalPos()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ReceiveRequestDialog::ReceiveRequestDialog(QWidget *parent) : |
|
|
|
ReceiveRequestDialog::ReceiveRequestDialog(QWidget *parent) : |
|
|
|
QDialog(parent), |
|
|
|
QDialog(parent), |
|
|
|
ui(new Ui::ReceiveRequestDialog), |
|
|
|
ui(new Ui::ReceiveRequestDialog), |
|
|
|