Bitcoin Core
28.99.0
P2P Digital Currency
src
qt
qrimagewidget.h
Go to the documentation of this file.
1
// Copyright (c) 2011-2020 The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_QT_QRIMAGEWIDGET_H
6
#define BITCOIN_QT_QRIMAGEWIDGET_H
7
8
#include <QImage>
9
#include <QLabel>
10
11
/* Maximum allowed URI length */
12
static
const
int
MAX_URI_LENGTH
= 255;
13
14
/* Size of exported QR Code image */
15
static
constexpr
int
QR_IMAGE_SIZE
= 300;
16
static
constexpr
int
QR_IMAGE_TEXT_MARGIN
= 10;
17
static
constexpr
int
QR_IMAGE_MARGIN
= 2 *
QR_IMAGE_TEXT_MARGIN
;
18
19
QT_BEGIN_NAMESPACE
20
class
QMenu;
21
QT_END_NAMESPACE
22
23
/* Label widget for QR code. This image can be dragged, dropped, copied and saved
24
* to disk.
25
*/
26
class
QRImageWidget
:
public
QLabel
27
{
28
Q_OBJECT
29
30
public
:
31
explicit
QRImageWidget
(QWidget *parent =
nullptr
);
32
bool
setQR
(
const
QString&
data
,
const
QString& text =
""
);
33
QImage
exportImage
();
34
35
public
Q_SLOTS:
36
void
saveImage
();
37
void
copyImage
();
38
39
protected
:
40
virtual
void
mousePressEvent
(QMouseEvent *event)
override
;
41
virtual
void
contextMenuEvent
(QContextMenuEvent *event)
override
;
42
43
private
:
44
QMenu*
contextMenu
{
nullptr
};
45
};
46
47
#endif
// BITCOIN_QT_QRIMAGEWIDGET_H
QRImageWidget
Definition:
qrimagewidget.h:27
QRImageWidget::copyImage
void copyImage()
Definition:
qrimagewidget.cpp:128
QRImageWidget::contextMenu
QMenu * contextMenu
Definition:
qrimagewidget.h:44
QRImageWidget::exportImage
QImage exportImage()
Definition:
qrimagewidget.cpp:93
QRImageWidget::contextMenuEvent
virtual void contextMenuEvent(QContextMenuEvent *event) override
Definition:
qrimagewidget.cpp:135
QRImageWidget::setQR
bool setQR(const QString &data, const QString &text="")
Definition:
qrimagewidget.cpp:32
QRImageWidget::mousePressEvent
virtual void mousePressEvent(QMouseEvent *event) override
Definition:
qrimagewidget.cpp:98
QRImageWidget::saveImage
void saveImage()
Definition:
qrimagewidget.cpp:113
QRImageWidget::QRImageWidget
QRImageWidget(QWidget *parent=nullptr)
Definition:
qrimagewidget.cpp:24
test_vectors_musig2_generate.data
data
Definition:
test_vectors_musig2_generate.py:98
QR_IMAGE_TEXT_MARGIN
static constexpr int QR_IMAGE_TEXT_MARGIN
Definition:
qrimagewidget.h:16
QR_IMAGE_SIZE
static constexpr int QR_IMAGE_SIZE
Definition:
qrimagewidget.h:15
QR_IMAGE_MARGIN
static constexpr int QR_IMAGE_MARGIN
Definition:
qrimagewidget.h:17
MAX_URI_LENGTH
static const int MAX_URI_LENGTH
Definition:
qrimagewidget.h:12
Generated on Wed Dec 18 2024 20:00:10 for Bitcoin Core by
1.9.4