QtPass 2.0.0
Developer documentation
Loading...
Searching...
No Matches
qpushbuttonwithclipboard.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2016 Anne Jan Brouwer
2// SPDX-License-Identifier: GPL-3.0-or-later
8#ifndef SRC_QPUSHBUTTONWITHCLIPBOARD_H_
9#define SRC_QPUSHBUTTONWITHCLIPBOARD_H_
10
11#include <QPushButton>
12
24class QWidget;
25class QPushButtonWithClipboard : public QPushButton {
26 Q_OBJECT
27
28public:
34 explicit QPushButtonWithClipboard(QString textToCopy = "",
35 QWidget *parent = nullptr);
36
41 [[nodiscard]] auto getTextToCopy() const -> QString;
46 void setTextToCopy(const QString &value);
47
48signals:
53 void clicked(const QString &text);
54
55private slots:
60 void changeIconDefault();
66 void buttonClicked(bool checked);
67
68private:
70 QString textToCopy;
72 QIcon iconEdit;
75};
76
77#endif // SRC_QPUSHBUTTONWITHCLIPBOARD_H_
void clicked(const QString &text)
Emitted when the button is activated with the stored text.
void setTextToCopy(const QString &value)
Update the stored text used for copying.
void changeIconDefault()
Restores the default copy icon; fired by a single-shot timer 500 ms after a click.
void buttonClicked(bool checked)
Connected to QPushButton::clicked(bool); shows the pushed icon, arms the revert timer and re-emits cl...
QPushButtonWithClipboard(QString textToCopy="", QWidget *parent=nullptr)
Construct a QPushButtonWithClipboard with an optional initial text.
auto getTextToCopy() const -> QString
Return the stored text used for copying.
QIcon iconEditPushed
document-new icon flashed for 500 ms after a click.
QIcon iconEdit
edit-copy icon shown at rest.
QString textToCopy
Text handed to receivers on click; set by the owning panel.