Line data Source code
1 : // SPDX-FileCopyrightText: 2016 Anne Jan Brouwer
2 : // SPDX-License-Identifier: GPL-3.0-or-later
3 : #ifndef SRC_QPUSHBUTTONWITHCLIPBOARD_H_
4 : #define SRC_QPUSHBUTTONWITHCLIPBOARD_H_
5 :
6 : #include <QPushButton>
7 :
8 : /*!
9 : \class QPushButtonWithClipboard
10 : \brief Stylish widget to allow copying of password and account details
11 : */
12 : class QWidget;
13 : class QPushButtonWithClipboard : public QPushButton {
14 : Q_OBJECT
15 :
16 : public:
17 0 : explicit QPushButtonWithClipboard(QString textToCopy = "",
18 : QWidget *parent = nullptr);
19 :
20 : [[nodiscard]] auto getTextToCopy() const -> QString;
21 : void setTextToCopy(const QString &value);
22 :
23 : signals:
24 : void clicked(const QString &);
25 :
26 : private slots:
27 : void changeIconDefault();
28 : void buttonClicked(bool);
29 :
30 : private:
31 : QString textToCopy;
32 : QIcon iconEdit;
33 : QIcon iconEditPushed;
34 : };
35 :
36 : #endif // SRC_QPUSHBUTTONWITHCLIPBOARD_H_
|