Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
ClipboardDevice.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 <phosphorwayland_export.h>
7
8#include <QByteArray>
9#include <QMap>
10#include <QObject>
11#include <QStringList>
12
13#include <memory>
14
15namespace PhosphorWayland {
16
37class PHOSPHORWAYLAND_EXPORT ClipboardDevice : public QObject
38{
39 Q_OBJECT
40 Q_DISABLE_COPY_MOVE(ClipboardDevice)
41
42public:
43 explicit ClipboardDevice(QObject* parent = nullptr);
44 ~ClipboardDevice() override;
45
49 static bool isSupported();
50
53 [[nodiscard]] QStringList mimeTypes() const;
54
59 void receive(const QString& mimeType);
60
64 void setSelection(const QMap<QString, QByteArray>& data);
65
66Q_SIGNALS:
69 void selectionChanged(const QStringList& mimeTypes);
70
72 void dataReceived(const QString& mimeType, const QByteArray& data);
73
74private:
75 class Private;
76 std::unique_ptr<Private> d;
77};
78
79} // namespace PhosphorWayland
Client-side wrapper around zwlr_data_control_device_v1.
Definition ClipboardDevice.h:38
QStringList mimeTypes() const
MIME types offered by the current clipboard selection, or an empty list when the selection is cleared...
ClipboardDevice(QObject *parent=nullptr)
void dataReceived(const QString &mimeType, const QByteArray &data)
Asynchronous result of receive(). data is empty on failure.
void selectionChanged(const QStringList &mimeTypes)
The clipboard selection changed; mimeTypes lists the offered types (empty when the selection was clea...
void receive(const QString &mimeType)
Asynchronously read the current clipboard selection as mimeType.
void setSelection(const QMap< QString, QByteArray > &data)
Take ownership of the clipboard selection, offering data keyed by MIME type; when a client pastes,...
static bool isSupported()
True iff the compositor advertises zwlr_data_control_manager_v1.
Definition ClipboardDevice.h:15