KGuiAddons

ksystemclipboard.h
1/*
2 SPDX-FileCopyrightText: 2020 David Edmundson <davidedmundson@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KSYSTEMCLIPBOARD_H
8#define KSYSTEMCLIPBOARD_H
9
10#include <kguiaddons_export.h>
11
12#include <QClipboard>
13#include <QObject>
14
15class QMimeData;
16
17/**
18 * This class mimics QClipboard but unlike QClipboard it will continue
19 * to get updates even when our window does not have focus.
20 *
21 * This may require extra access permissions
22 *
23 * @since 5.89
24 */
25class KGUIADDONS_EXPORT KSystemClipboard : public QObject
26{
27 Q_OBJECT
28public:
29 /**
30 * Returns a shared global SystemClipboard instance
31 */
32 static KSystemClipboard *instance();
33
34 /**
35 * Sets the clipboard to the new contents
36 * The clipboard takes ownership of mime
37 */
38 virtual void setMimeData(QMimeData *mime, QClipboard::Mode mode) = 0;
39 /**
40 * Clears the current clipboard
41 */
42 virtual void clear(QClipboard::Mode mode) = 0;
43 /**
44 * Returns the current mime data received by the clipboard
45 */
46 virtual const QMimeData *mimeData(QClipboard::Mode mode) const = 0;
47 /**
48 * Returns the text content of the Clipboard
49 *
50 * Similar to QClipboard::text(QClipboard::Mode mode)
51 */
52 QString text(QClipboard::Mode mode);
54 /**
55 * Emitted when the clipboard changes similar to QClipboard::changed
56 */
58
59protected:
61};
62
63#endif
This class mimics QClipboard but unlike QClipboard it will continue to get updates even when our wind...
virtual void setMimeData(QMimeData *mime, QClipboard::Mode mode)=0
Sets the clipboard to the new contents The clipboard takes ownership of mime.
virtual void clear(QClipboard::Mode mode)=0
Clears the current clipboard.
void changed(QClipboard::Mode mode)
Emitted when the clipboard changes similar to QClipboard::changed.
virtual const QMimeData * mimeData(QClipboard::Mode mode) const =0
Returns the current mime data received by the clipboard.
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:02:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.