8#ifndef SRC_SECRETLINEEDIT_H_
9#define SRC_SECRETLINEEDIT_H_
76 explicit SecretLineEdit(
const QString &text, QWidget *parent =
nullptr);
91 [[nodiscard]]
static auto isLineBreak(QChar ch) -> bool;
void mouseReleaseEvent(QMouseEvent *event) override
Fills the primary selection with the marked selection on a left-button release, instead of QLineEdit'...
void copied(const QString &text)
Selected text was copied out of the line edit.
void cutSelection()
Copies the selection through copySelection() and then deletes it. Does nothing when read-only or with...
void withoutPlainSelectionCopy(const std::function< void()> &handler)
Runs a base-class event handler so that it cannot fill the primary selection with plain text: in a re...
static auto withoutLineBreaks(QString text) -> QString
text with every line break (see isLineBreak()) removed: what a one-line field keeps of a paste.
auto createSecretContextMenu() -> QMenu *
The standard context menu, with Copy and Cut going through the secret copy.
void publishSelection()
Fills the X11 primary selection with the marked selection, on platforms that have one; called after a...
SecretLineEdit(QWidget *parent=nullptr)
Constructs the line edit.
void contextMenuEvent(QContextMenuEvent *event) override
Shows createSecretContextMenu().
static constexpr int kMaxLength
Most characters the line edit holds (1 MiB of them): its maxLength in place of QLineEdit's 32767.
void setStoredText(const QString &text)
Shows a value read from the entry exactly as it is stored.
static auto isLineBreak(QChar ch) -> bool
Whether ch breaks a line: LF, CR, NEL (U+0085), or the Unicode line and paragraph separators (U+2028,...
void markUndoBoundary()
Ends the current undo step, so that the next edit starts its own, as QLineEdit::paste() does around a...
void pasteOneLine(QClipboard::Mode mode)
Pastes the clipboard or the primary selection with its line breaks removed, as one undoable edit....
void copySelection(QClipboard::Mode mode)
Puts the selection on the clipboard or in the primary selection as secret-marked MIME data and emits ...
void keyPressEvent(QKeyEvent *event) override
Ctrl+C copies with the hints, Ctrl+X as well before it deletes; after any other key the primary selec...