kernel/qclipboard.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6QClipboard::QClipboard(QObject *parent) -
7 : QObject(parent) -
8{ -
9 -
10}
executed: }
Execution Count:6
6
11QClipboard::~QClipboard() -
12{ -
13} -
14QString QClipboard::text(QString &subtype, Mode mode) const -
15{ -
16 const QMimeData *const data = mimeData(mode); -
17 if (!data)
never evaluated: !data
0
18 return QString();
never executed: return QString();
0
19 -
20 const QStringList formats = data->formats(); -
21 if (subtype.isEmpty()) {
never evaluated: subtype.isEmpty()
0
22 if (formats.contains(QLatin1String("text/plain")))
never evaluated: formats.contains(QLatin1String("text/plain"))
0
23 subtype = QLatin1String("plain");
never executed: subtype = QLatin1String("plain");
0
24 else { -
25 for (int i = 0; i < formats.size(); ++i)
never evaluated: i < formats.size()
0
26 if (formats.at(i).startsWith(QLatin1String("text/"))) {
never evaluated: formats.at(i).startsWith(QLatin1String("text/"))
0
27 subtype = formats.at(i).mid(5); -
28 break;
never executed: break;
0
29 } -
30 if (subtype.isEmpty())
never evaluated: subtype.isEmpty()
0
31 return QString();
never executed: return QString();
0
32 }
never executed: }
0
33 } else if (!formats.contains(QLatin1String("text/") + subtype)) {
never evaluated: !formats.contains(QLatin1String("text/") + subtype)
0
34 return QString();
never executed: return QString();
0
35 } -
36 -
37 const QByteArray rawData = data->data(QLatin1String("text/") + subtype); -
38 -
39 -
40 QTextCodec* codec = QTextCodec::codecForMib(106); -
41 if (subtype == QLatin1String("html"))
never evaluated: subtype == QLatin1String("html")
0
42 codec = QTextCodec::codecForHtml(rawData, codec);
never executed: codec = QTextCodec::codecForHtml(rawData, codec);
0
43 else -
44 codec = QTextCodec::codecForUtfText(rawData, codec);
never executed: codec = QTextCodec::codecForUtfText(rawData, codec);
0
45 return codec->toUnicode(rawData);
never executed: return codec->toUnicode(rawData);
0
46 -
47 -
48 -
49} -
50QString QClipboard::text(Mode mode) const -
51{ -
52 const QMimeData *data = mimeData(mode); -
53 return data ? data->text() : QString();
executed: return data ? data->text() : QString();
Execution Count:28
28
54} -
55void QClipboard::setText(const QString &text, Mode mode) -
56{ -
57 QMimeData *data = new QMimeData; -
58 data->setText(text); -
59 setMimeData(data, mode); -
60}
executed: }
Execution Count:21
21
61QImage QClipboard::image(Mode mode) const -
62{ -
63 const QMimeData *data = mimeData(mode); -
64 if (!data)
never evaluated: !data
0
65 return QImage();
never executed: return QImage();
0
66 return qvariant_cast<QImage>(data->imageData());
never executed: return qvariant_cast<QImage>(data->imageData());
0
67} -
68void QClipboard::setImage(const QImage &image, Mode mode) -
69{ -
70 QMimeData *data = new QMimeData; -
71 data->setImageData(image); -
72 setMimeData(data, mode); -
73}
never executed: }
0
74QPixmap QClipboard::pixmap(Mode mode) const -
75{ -
76 const QMimeData *data = mimeData(mode); -
77 return data ? qvariant_cast<QPixmap>(data->imageData()) : QPixmap();
never executed: return data ? qvariant_cast<QPixmap>(data->imageData()) : QPixmap();
0
78} -
79void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode) -
80{ -
81 QMimeData *data = new QMimeData; -
82 data->setImageData(pixmap); -
83 setMimeData(data, mode); -
84}
never executed: }
0
85bool QClipboard::supportsSelection() const -
86{ -
87 return supportsMode(Selection);
executed: return supportsMode(Selection);
Execution Count:17
17
88} -
89 -
90 -
91 -
92 -
93 -
94bool QClipboard::supportsFindBuffer() const -
95{ -
96 return supportsMode(FindBuffer);
executed: return supportsMode(FindBuffer);
Execution Count:5
5
97} -
98 -
99 -
100 -
101 -
102 -
103bool QClipboard::ownsClipboard() const -
104{ -
105 return ownsMode(Clipboard);
executed: return ownsMode(Clipboard);
Execution Count:1
1
106} -
107 -
108 -
109 -
110 -
111 -
112bool QClipboard::ownsSelection() const -
113{ -
114 return ownsMode(Selection);
executed: return ownsMode(Selection);
Execution Count:1
1
115} -
116 -
117 -
118 -
119 -
120 -
121 -
122 -
123bool QClipboard::ownsFindBuffer() const -
124{ -
125 return ownsMode(FindBuffer);
executed: return ownsMode(FindBuffer);
Execution Count:1
1
126} -
127void QClipboard::emitChanged(Mode mode) -
128{ -
129 switch (mode) { -
130 case Clipboard: -
131 dataChanged(); -
132 break;
executed: break;
Execution Count:38
38
133 case Selection: -
134 selectionChanged(); -
135 break;
executed: break;
Execution Count:7
7
136 case FindBuffer: -
137 findBufferChanged(); -
138 break;
never executed: break;
0
139 default: -
140 break;
never executed: break;
0
141 } -
142 changed(mode); -
143}
executed: }
Execution Count:45
45
144 -
145 -
146 -
147 -
148 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial