Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
ClipboardService.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <PhosphorServiceClipboard/phosphorserviceclipboard_export.h>
7
8#include <QAbstractItemModel>
9#include <QObject>
10
11#include <memory>
12
14
29class PHOSPHORSERVICECLIPBOARD_EXPORT ClipboardService : public QObject
30{
31 Q_OBJECT
32 Q_PROPERTY(bool supported READ isSupported CONSTANT)
33 Q_PROPERTY(QAbstractItemModel* history READ history CONSTANT)
34 Q_PROPERTY(int count READ count NOTIFY countChanged)
35
36public:
37 explicit ClipboardService(QObject* parent = nullptr);
39
43 [[nodiscard]] bool isSupported() const;
44
46 [[nodiscard]] QAbstractItemModel* history() const;
47
49 [[nodiscard]] int count() const;
50
57 Q_INVOKABLE bool copy(int index);
60 Q_INVOKABLE bool remove(int index);
62 Q_INVOKABLE void clear();
63
64Q_SIGNALS:
66
67private:
68 Q_DISABLE_COPY_MOVE(ClipboardService)
69
70 class Private;
71 std::unique_ptr<Private> d;
72};
73
74} // namespace PhosphorServiceClipboard
int count() const
Number of entries in the history.
bool isSupported() const
Whether the compositor advertises the wlr-data-control protocol this service builds on.
void clear()
Clear the entire history (and disk).
ClipboardService(QObject *parent=nullptr)
QAbstractItemModel * history() const
The history list model (most-recent first). Owned by the service.
bool remove(int index)
Remove the entry at index from the history (and disk).
bool copy(int index)
Re-apply the entry at index to the clipboard selection.
Definition ClipboardService.h:13