QtPass 1.4.0
Multi-platform GUI for pass, the standard unix password manager.
Loading...
Searching...
No Matches
qpushbuttonwithclipboard.cpp
Go to the documentation of this file.
2#include <QTimer>
3
13 QWidget *parent)
14 : QPushButton(parent), textToCopy(textToCopy),
15 iconEdit(QIcon::fromTheme("edit-copy", QIcon(":/icons/edit-copy.svg"))),
16 iconEditPushed(
17 QIcon::fromTheme("document-new", QIcon(":/icons/document-new.svg"))) {
18 setIcon(iconEdit);
19 connect(this, SIGNAL(clicked(bool)), this, SLOT(buttonClicked(bool)));
20}
21
27QString QPushButtonWithClipboard::getTextToCopy() const { return textToCopy; }
28
34void QPushButtonWithClipboard::setTextToCopy(const QString &value) {
35 textToCopy = value;
36}
37
42void QPushButtonWithClipboard::buttonClicked(bool) {
43 setIcon(iconEditPushed);
44 QTimer::singleShot(500, this, SLOT(changeIconDefault()));
45 emit clicked(textToCopy);
46}
47
52void QPushButtonWithClipboard::changeIconDefault() { this->setIcon(iconEdit); }
void setTextToCopy(const QString &value)
QPushButtonWithClipboard::setTextToCopy sets text from associated text field.
QString getTextToCopy() const
QPushButtonWithClipboard::getTextToCopy returns the text of associated text field.
QPushButtonWithClipboard(const QString &textToCopy="", QWidget *parent=nullptr)
QPushButtonWithClipboard::QPushButtonWithClipboard basic constructor.