qclipboard.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qclipboard.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7QClipboard::QClipboard(QObject *parent)-
8 : QObject(parent)-
9{-
10-
11}
never executed: end of block
0
12QClipboard::~QClipboard()-
13{-
14}-
15QString QClipboard::text(QString &subtype, Mode mode) const-
16{-
17 const QMimeData *const data = mimeData(mode);-
18 if (!data
!dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
19 return
never executed: return QString();
QString();
never executed: return QString();
0
20-
21 const QStringList formats = data->formats();-
22 if (subtype.isEmpty()
subtype.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
23 if (formats.contains(QLatin1String("text/plain"))
formats.contai..."text/plain"))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
24 subtype = QLatin1String("plain");
never executed: subtype = QLatin1String("plain");
0
25 else {-
26 for (int i = 0; i < formats.size()
i < formats.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
27 if (formats.at(i).startsWith(QLatin1String("text/"))
formats.at(i)....ring("text/"))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
28 subtype = formats.at(i).mid(5);-
29 break;
never executed: break;
0
30 }-
31 if (subtype.isEmpty()
subtype.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
32 return
never executed: return QString();
QString();
never executed: return QString();
0
33 }
never executed: end of block
0
34 } else if (!formats.contains(QLatin1String("text/") + subtype)
!formats.conta.../") + subtype)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
35 return
never executed: return QString();
QString();
never executed: return QString();
0
36 }-
37-
38 const QByteArray rawData = data->data(QLatin1String("text/") + subtype);-
39-
40-
41 QTextCodec* codec = QTextCodec::codecForMib(106);-
42 if (subtype == QLatin1String("html")
subtype == QLa...String("html")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
43 codec = QTextCodec::codecForHtml(rawData, codec);
never executed: codec = QTextCodec::codecForHtml(rawData, codec);
0
44 else-
45 codec = QTextCodec::codecForUtfText(rawData, codec);
never executed: codec = QTextCodec::codecForUtfText(rawData, codec);
0
46 return
never executed: return codec->toUnicode(rawData);
codec->toUnicode(rawData);
never executed: return codec->toUnicode(rawData);
0
47-
48-
49-
50}-
51QString QClipboard::text(Mode mode) const-
52{-
53 const QMimeData *data = mimeData(mode);-
54 return
never executed: return data ? data->text() : QString();
data ? data->text() : QString();
never executed: return data ? data->text() : QString();
0
55}-
56void QClipboard::setText(const QString &text, Mode mode)-
57{-
58 QMimeData *data = new QMimeData;-
59 data->setText(text);-
60 setMimeData(data, mode);-
61}
never executed: end of block
0
62QImage QClipboard::image(Mode mode) const-
63{-
64 const QMimeData *data = mimeData(mode);-
65 if (!data
!dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
66 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
67 return
never executed: return qvariant_cast<QImage>(data->imageData());
qvariant_cast<QImage>(data->imageData());
never executed: return qvariant_cast<QImage>(data->imageData());
0
68}-
69void QClipboard::setImage(const QImage &image, Mode mode)-
70{-
71 QMimeData *data = new QMimeData;-
72 data->setImageData(image);-
73 setMimeData(data, mode);-
74}
never executed: end of block
0
75QPixmap QClipboard::pixmap(Mode mode) const-
76{-
77 const QMimeData *data = mimeData(mode);-
78 return
never executed: return data ? qvariant_cast<QPixmap>(data->imageData()) : QPixmap();
data ? qvariant_cast<QPixmap>(data->imageData()) : QPixmap();
never executed: return data ? qvariant_cast<QPixmap>(data->imageData()) : QPixmap();
0
79}-
80void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode)-
81{-
82 QMimeData *data = new QMimeData;-
83 data->setImageData(pixmap);-
84 setMimeData(data, mode);-
85}
never executed: end of block
0
86const QMimeData* QClipboard::mimeData(Mode mode) const-
87{-
88 QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();-
89 if (!clipboard->supportsMode(mode)
!clipboard->supportsMode(mode)Description
TRUEnever evaluated
FALSEnever evaluated
) return
never executed: return 0;
0;
never executed: return 0;
0
90 return
never executed: return clipboard->mimeData(mode);
clipboard->mimeData(mode);
never executed: return clipboard->mimeData(mode);
0
91}-
92void QClipboard::setMimeData(QMimeData* src, Mode mode)-
93{-
94 QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();-
95 if (!clipboard->supportsMode(mode)
!clipboard->supportsMode(mode)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
96 if (src != 0
src != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
97 QMessageLogger(__FILE__, 475, __PRETTY_FUNCTION__).warning("Data set on unsupported clipboard mode. QMimeData object will be deleted.");-
98 src->deleteLater();-
99 }
never executed: end of block
0
100 }
never executed: end of block
else {
0
101 clipboard->setMimeData(src,mode);-
102 }
never executed: end of block
0
103}-
104void QClipboard::clear(Mode mode)-
105{-
106 setMimeData(0, mode);-
107}
never executed: end of block
0
108-
109-
110-
111-
112-
113bool QClipboard::supportsSelection() const-
114{-
115 return
never executed: return supportsMode(Selection);
supportsMode(Selection);
never executed: return supportsMode(Selection);
0
116}-
117-
118-
119-
120-
121-
122bool QClipboard::supportsFindBuffer() const-
123{-
124 return
never executed: return supportsMode(FindBuffer);
supportsMode(FindBuffer);
never executed: return supportsMode(FindBuffer);
0
125}-
126-
127-
128-
129-
130-
131bool QClipboard::ownsClipboard() const-
132{-
133 return
never executed: return ownsMode(Clipboard);
ownsMode(Clipboard);
never executed: return ownsMode(Clipboard);
0
134}-
135-
136-
137-
138-
139-
140bool QClipboard::ownsSelection() const-
141{-
142 return
never executed: return ownsMode(Selection);
ownsMode(Selection);
never executed: return ownsMode(Selection);
0
143}-
144-
145-
146-
147-
148-
149-
150-
151bool QClipboard::ownsFindBuffer() const-
152{-
153 return
never executed: return ownsMode(FindBuffer);
ownsMode(FindBuffer);
never executed: return ownsMode(FindBuffer);
0
154}-
155-
156-
157-
158-
159-
160-
161-
162bool QClipboard::supportsMode(Mode mode) const-
163{-
164 QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();-
165 return
never executed: return clipboard->supportsMode(mode);
clipboard->supportsMode(mode);
never executed: return clipboard->supportsMode(mode);
0
166}-
167-
168-
169-
170-
171-
172-
173-
174bool QClipboard::ownsMode(Mode mode) const-
175{-
176 QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();-
177 return
never executed: return clipboard->ownsMode(mode);
clipboard->ownsMode(mode);
never executed: return clipboard->ownsMode(mode);
0
178}-
179-
180-
181-
182-
183-
184void QClipboard::emitChanged(Mode mode)-
185{-
186 switch (mode) {-
187 case
never executed: case Clipboard:
Clipboard:
never executed: case Clipboard:
0
188 dataChanged();-
189 break;
never executed: break;
0
190 case
never executed: case Selection:
Selection:
never executed: case Selection:
0
191 selectionChanged();-
192 break;
never executed: break;
0
193 case
never executed: case FindBuffer:
FindBuffer:
never executed: case FindBuffer:
0
194 findBufferChanged();-
195 break;
never executed: break;
0
196 default
never executed: default:
:
never executed: default:
0
197 break;
never executed: break;
0
198 }-
199 changed(mode);-
200}
never executed: end of block
0
201-
202-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9