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:
54 void textClicked(const QString &text);
55
56private slots:
61 void changeIconDefault();
67 void buttonClicked(bool checked);
68
69private:
71 QString textToCopy;
73 QIcon iconEdit;
76};
77
78#endif // SRC_QPUSHBUTTONWITHCLIPBOARD_H_
void textClicked(const QString &text)
Emitted when the button is activated with the stored text. Not named clicked(): that would hide QAbst...
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 emits textC...
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.