aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/ShowCopyDialog.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-08-10 14:06:45 +0000
committerSaturneric <[email protected]>2021-08-10 14:06:45 +0000
commit61ced076e5effd3f8ddc76372242ba5fa67b6303 (patch)
tree4722a7cea8387c83f470d170d88e5a8164498d0b /src/ui/ShowCopyDialog.cpp
parentMerge branch 'develop-ci' into develop (diff)
downloadGpgFrontend-61ced076e5effd3f8ddc76372242ba5fa67b6303.tar.gz
GpgFrontend-61ced076e5effd3f8ddc76372242ba5fa67b6303.zip
Add Functions:
GpgFrontend Settings Service Token Short Crypto Text Functions TODO: Revoke Cert Generation
Diffstat (limited to 'src/ui/ShowCopyDialog.cpp')
-rw-r--r--src/ui/ShowCopyDialog.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ui/ShowCopyDialog.cpp b/src/ui/ShowCopyDialog.cpp
new file mode 100644
index 00000000..58a6cf0a
--- /dev/null
+++ b/src/ui/ShowCopyDialog.cpp
@@ -0,0 +1,26 @@
+//
+// Created by Administrator on 2021/7/21.
+//
+
+#include "ui/ShowCopyDialog.h"
+
+ShowCopyDialog::ShowCopyDialog(const QString &text, QWidget *parent) : QDialog(parent) {
+ textEdit = new QTextEdit();
+ textEdit->setReadOnly(true);
+ textEdit->setLineWrapMode(QTextEdit::WidgetWidth);
+ textEdit->setText(text);
+ copyButton = new QPushButton("Copy");
+ connect(copyButton, SIGNAL(clicked(bool)), this, SLOT(slotCopyText()));
+
+ auto *layout = new QVBoxLayout();
+ layout->addWidget(textEdit);
+ layout->addWidget(copyButton);
+
+ this->setModal(true);
+ this->setLayout(layout);
+}
+
+void ShowCopyDialog::slotCopyText() {
+ QClipboard *cb = QApplication::clipboard();
+ cb->setText(textEdit->toPlainText());
+}