17#if defined(HAVE_CONFIG_H)
18#include <config/bitcoin-config.h>
26 : QLabel(parent), contextMenu(
nullptr) {
39#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
40 return !pixmap(Qt::ReturnByValue).isNull();
42 return pixmap() !=
nullptr;
55 setText(
tr(
"Resulting URI too long, try to reduce the text for label / "
64 setText(
tr(
"Error encoding URI into QR Code."));
69 QImage(code->width + 8, code->width + 8, QImage::Format_RGB32);
72 for (
int y = 0; y < code->width; ++y) {
73 for (
int x = 0; x < code->width; ++x) {
74 qrImage.setPixel(x + 4, y + 4, ((*
p & 1) ? 0x0 : 0xffffff));
82 QImage::Format_RGB32);
87 if (!text.isEmpty()) {
106 setText(
tr(
"QR code support not available."));
112#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
113 return pixmap(Qt::ReturnByValue).toImage();
120 if (event->button() == Qt::LeftButton &&
hasPixmap()) {
129 QLabel::mousePressEvent(event);
138 tr(
"PNG Image (*.png)"),
nullptr);
148 QApplication::clipboard()->setImage(
exportImage());
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix when ...
qreal calculateIdealFontSize(int width, const QString &text, QFont font, qreal minPointSize, qreal font_size)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...