QtPass 2.0.0
Developer documentation
Loading...
Searching...
No Matches
secretplaintextedit.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Anne Jan Brouwer
2// SPDX-License-Identifier: GPL-3.0-or-later
9#include "clipboardmanager.h"
10#include <QTextCursor>
11#include <QTextDocumentFragment>
12
14 : QPlainTextEdit(parent) {}
15
17 const QString text = textCursor().selection().toPlainText();
18 // copied() is a notification, not a change to this widget; the signal is
19 // declared non-const as all signals are.
20 emit const_cast<SecretPlainTextEdit *>(this)->copied(text);
21 return buildClipboardMimeData(text);
22}
auto createMimeDataFromSelection() const -> QMimeData *override
The selection as secret-marked plain text.
SecretPlainTextEdit(QWidget *parent=nullptr)
Constructs the editor.
void copied(const QString &text)
Selected text was copied or cut out of the editor.
auto buildClipboardMimeData(const QString &text) -> QMimeData *
Build clipboard MIME data with platform-specific security hints.
ClipboardManager, which puts secrets on the clipboard and removes them again, and the MIME data that ...
QPlainTextEdit for editing decrypted entry text that marks everything copied out of it as a secret.