1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QCLIPBOARD_H
5#define QCLIPBOARD_H
6
7#include <QtGui/qtguiglobal.h>
8#include <QtCore/qobject.h>
9
10QT_BEGIN_NAMESPACE
11
12
13#ifndef QT_NO_CLIPBOARD
14
15class QMimeData;
16class QImage;
17class QPixmap;
18
19class Q_GUI_EXPORT QClipboard : public QObject
20{
21 Q_OBJECT
22private:
23 explicit QClipboard(QObject *parent);
24 ~QClipboard();
25
26public:
27 enum Mode { Clipboard, Selection, FindBuffer, LastMode = FindBuffer };
28
29 void clear(Mode mode = Clipboard);
30
31 bool supportsSelection() const;
32 bool supportsFindBuffer() const;
33
34 bool ownsSelection() const;
35 bool ownsClipboard() const;
36 bool ownsFindBuffer() const;
37
38 QString text(Mode mode = Clipboard) const;
39 QString text(QString& subtype, Mode mode = Clipboard) const;
40 void setText(const QString &, Mode mode = Clipboard);
41
42 const QMimeData *mimeData(Mode mode = Clipboard ) const;
43 void setMimeData(QMimeData *data, Mode mode = Clipboard);
44
45 QImage image(Mode mode = Clipboard) const;
46 QPixmap pixmap(Mode mode = Clipboard) const;
47 void setImage(const QImage &, Mode mode = Clipboard);
48 void setPixmap(const QPixmap &, Mode mode = Clipboard);
49
50Q_SIGNALS:
51 void changed(QClipboard::Mode mode);
52 void selectionChanged();
53 void findBufferChanged();
54 void dataChanged();
55
56protected:
57 friend class QApplication;
58 friend class QApplicationPrivate;
59 friend class QGuiApplication;
60 friend class QBaseApplication;
61 friend class QDragManager;
62 friend class QPlatformClipboard;
63
64private:
65 Q_DISABLE_COPY(QClipboard)
66
67 bool supportsMode(Mode mode) const;
68 bool ownsMode(Mode mode) const;
69 void emitChanged(Mode mode);
70};
71
72#endif // QT_NO_CLIPBOARD
73
74QT_END_NAMESPACE
75
76#endif // QCLIPBOARD_H
77

source code of qtbase/src/gui/kernel/qclipboard.h