mutterkey
KDE-first push-to-talk transcription tool for KDE Plasma
Loading...
Searching...
No Matches
clipboardwriter.h
Go to the documentation of this file.
1#pragma once
2
3#include <QClipboard>
4#include <QObject>
5#include <QString>
6
7class KSystemClipboard;
8
15[[nodiscard]] QString clipboardBackendName(bool hasSystemClipboard, bool hasQtClipboard);
16
23[[nodiscard]] bool clipboardRoundTripSucceeded(const QString &requestedText, const QString &actualText);
24
36class ClipboardWriter final : public QObject
37{
38 Q_OBJECT
39
40public:
46 explicit ClipboardWriter(QClipboard *clipboard, QObject *parent = nullptr);
47
53 [[nodiscard]] bool copy(const QString &text);
54
59 [[nodiscard]] QString backendName() const;
60
61private:
67 [[nodiscard]] bool copyWithSystemClipboard(const QString &text);
68
74 [[nodiscard]] bool copyWithQtClipboard(const QString &text);
75
77 QClipboard *m_clipboard = nullptr;
79 KSystemClipboard *m_systemClipboard = nullptr;
80};
Copies transcription text to the clipboard.
ClipboardWriter(QClipboard *clipboard, QObject *parent=nullptr)
Creates a clipboard writer bound to the application's clipboard.
bool copy(const QString &text)
Copies text to the best available clipboard backend.
QString backendName() const
Reports the active backend name for diagnostics.
bool clipboardRoundTripSucceeded(const QString &requestedText, const QString &actualText)
Reports whether a clipboard round-trip returned the requested text.
QString clipboardBackendName(bool hasSystemClipboard, bool hasQtClipboard)
Reports the clipboard backend name from backend availability flags.