Qt 4.8
qclipboard_qpa.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qclipboard.h"
43 
44 #ifndef QT_NO_CLIPBOARD
45 
46 #include "qmimedata.h"
47 #include "private/qapplication_p.h"
48 #include "qplatformclipboard_qpa.h"
49 
51 
53 
54 void QClipboard::clear(Mode mode)
55 {
56  setMimeData(0,mode);
57 }
58 
59 
61 {
62  return QObject::event(e);
63 }
64 
65 const QMimeData* QClipboard::mimeData(Mode mode) const
66 {
67  QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard();
68  if (!clipboard->supportsMode(mode)) return 0;
69  return clipboard->mimeData(mode);
70 }
71 
72 void QClipboard::setMimeData(QMimeData* src, Mode mode)
73 {
74  QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard();
75  if (!clipboard->supportsMode(mode)) return;
76 
77  clipboard->setMimeData(src,mode);
78 
79  emitChanged(mode);
80 }
81 
82 bool QClipboard::supportsMode(Mode mode) const
83 {
84  QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard();
85  return clipboard->supportsMode(mode);
86 }
87 
88 bool QClipboard::ownsMode(Mode mode) const
89 {
90  if (mode == Clipboard)
91  qWarning("QClipboard::ownsClipboard: UNIMPLEMENTED!");
92  return false;
93 }
94 
95 void QClipboard::connectNotify( const char * )
96 {
97 }
98 
100 {
101 }
102 
103 #endif // QT_NO_CLIPBOARD
104 
Mode
This enum type is used to control which part of the system clipboard is used by QClipboard::mimeData(...
Definition: qclipboard.h:71
static QWaylandClipboard * clipboard
void clear(Mode mode=Clipboard)
Clear the clipboard contents.
void emitChanged(Mode mode)
Emits the appropriate changed signal for mode.
Definition: qclipboard.cpp:640
virtual QMimeData * mimeData(QClipboard::Mode mode=QClipboard::Clipboard)
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
bool event(QEvent *)
Reimplemented Function
void ownerDestroyed()
Internal cleanup for Windows.
virtual void setMimeData(QMimeData *data, QClipboard::Mode mode=QClipboard::Clipboard)
bool supportsMode(Mode mode) const
Returns true if the clipboard supports the clipboard mode speacified by mode; otherwise returns false...
void setMimeData(QMimeData *data, Mode mode=Clipboard)
Sets the clipboard data to src.
bool ownsMode(Mode mode) const
Returns true if the clipboard supports the clipboard data speacified by mode; otherwise returns false...
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
Definition: qobject.cpp:1200
const QMimeData * mimeData(Mode mode=Clipboard) const
Returns a reference to a QMimeData representation of the current clipboard data.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
Q_CORE_EXPORT void qWarning(const char *,...)
The QMimeData class provides a container for data that records information about its MIME type...
Definition: qmimedata.h:57
Mode
Definition: qaudio.h:60
virtual bool supportsMode(QClipboard::Mode mode) const
#define QT_USE_NAMESPACE
This macro expands to using QT_NAMESPACE if QT_NAMESPACE is defined and nothing otherwise.
Definition: qglobal.h:88
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
void connectNotify(const char *)
Internal optimization for Windows.