QtPass
2.0.0
Developer documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
secretlineedit.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2026 Anne Jan Brouwer
2
// SPDX-License-Identifier: GPL-3.0-or-later
8
#ifndef SRC_SECRETLINEEDIT_H_
9
#define SRC_SECRETLINEEDIT_H_
10
11
#include <QClipboard>
12
#include <QLineEdit>
13
#include <functional>
14
15
class
QMenu;
16
44
class
SecretLineEdit
:
public
QLineEdit {
45
Q_OBJECT
46
47
public
:
52
explicit
SecretLineEdit
(QWidget *parent =
nullptr
);
53
59
[[nodiscard]]
auto
createSecretContextMenu
() -> QMenu *;
60
61
signals:
66
void
copied
(
const
QString &text);
67
68
protected
:
75
void
keyPressEvent
(QKeyEvent *event)
override
;
76
82
void
mouseReleaseEvent
(QMouseEvent *event)
override
;
83
88
void
contextMenuEvent
(QContextMenuEvent *event)
override
;
89
90
private
:
98
void
copySelection
(QClipboard::Mode mode);
103
void
cutSelection
();
112
void
withoutPlainSelectionCopy
(
const
std::function<
void
()> &handler);
118
void
publishSelection
();
119
};
120
121
#endif
// SRC_SECRETLINEEDIT_H_
SecretLineEdit::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *event) override
Fills the primary selection with the marked selection on a left-button release, instead of QLineEdit'...
Definition
secretlineedit.cpp:67
SecretLineEdit::copied
void copied(const QString &text)
Selected text was copied out of the line edit.
SecretLineEdit::cutSelection
void cutSelection()
Copies the selection through copySelection() and then deletes it. Does nothing when read-only or with...
Definition
secretlineedit.cpp:91
SecretLineEdit::withoutPlainSelectionCopy
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...
Definition
secretlineedit.cpp:100
SecretLineEdit::createSecretContextMenu
auto createSecretContextMenu() -> QMenu *
The standard context menu, with Copy and Cut going through the secret copy.
Definition
secretlineedit.cpp:19
SecretLineEdit::publishSelection
void publishSelection()
Fills the X11 primary selection with the marked selection, on platforms that have one; called after a...
Definition
secretlineedit.cpp:119
SecretLineEdit::SecretLineEdit
SecretLineEdit(QWidget *parent=nullptr)
Constructs the line edit.
Definition
secretlineedit.cpp:17
SecretLineEdit::contextMenuEvent
void contextMenuEvent(QContextMenuEvent *event) override
Shows createSecretContextMenu().
Definition
secretlineedit.cpp:75
SecretLineEdit::copySelection
void copySelection(QClipboard::Mode mode)
Puts the selection on the clipboard or in the primary selection as secret-marked MIME data and emits ...
Definition
secretlineedit.cpp:81
SecretLineEdit::keyPressEvent
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...
Definition
secretlineedit.cpp:36
src
secretlineedit.h
Generated by
1.18.0