QtPass 2.0.0
Developer documentation
Loading...
Searching...
No Matches
qpushbuttonasqrcode.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2018 Anne Jan Brouwer
2// SPDX-License-Identifier: GPL-3.0-or-later
8#include <QTimer>
9#include <utility>
10
12 : QPushButton(parent), textToCopy(std::move(textToCopy)),
13 iconEdit(QIcon::fromTheme("qrcode", QIcon(":/icons/qrcode.svg"))) {
14 setIcon(iconEdit);
15 // Icon-only: give screen readers and hovering users a name.
16 setToolTip(tr("Show as QR code"));
17 setAccessibleName(tr("Show as QR code"));
18 setForegroundRole(QPalette::ButtonText);
19 connect(this, &QPushButton::clicked, this,
21}
22
23auto QPushButtonAsQRCode::getTextToCopy() const -> QString {
24 return textToCopy;
25}
26
27void QPushButtonAsQRCode::setTextToCopy(const QString &value) {
28 textToCopy = value;
29}
30
32 emit clicked(textToCopy);
33}
void buttonClicked(bool checked)
Connected to QPushButton::clicked(bool); re-emits the overload carrying the stored text so receivers ...
void clicked(const QString &text)
Emitted when the button is activated with the current text payload.
QPushButtonAsQRCode(QString textToCopy="", QWidget *parent=nullptr)
Construct a QPushButtonAsQRCode with an optional initial text.
QIcon iconEdit
The qrcode icon shown on the button.
QString textToCopy
Text to be rendered as a QR code; set by the owning panel.
void setTextToCopy(const QString &value)
Update the stored text used for QR-code actions.
auto getTextToCopy() const -> QString
Return the stored text used for QR-code actions.
Icon button that asks for a stored secret to be shown as a QR code.