Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 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 "qplatformdefs.h" | - |
43 | | - |
44 | #include "qbitmap.h" | - |
45 | #include "qdrag.h" | - |
46 | #include "qpixmap.h" | - |
47 | #include "qevent.h" | - |
48 | #include "qfile.h" | - |
49 | #include "qtextcodec.h" | - |
50 | #include "qguiapplication.h" | - |
51 | #include "qpoint.h" | - |
52 | #include "qbuffer.h" | - |
53 | #include "qimage.h" | - |
54 | #include "qpainter.h" | - |
55 | #include "qregexp.h" | - |
56 | #include "qdir.h" | - |
57 | #include "qdnd_p.h" | - |
58 | #include "qimagereader.h" | - |
59 | #include "qimagewriter.h" | - |
60 | #include "qdebug.h" | - |
61 | #include <ctype.h> | - |
62 | #include <qpa/qplatformintegration.h> | - |
63 | #include <qpa/qplatformdrag.h> | - |
64 | | - |
65 | #include <private/qguiapplication_p.h> | - |
66 | | - |
67 | #ifndef QT_NO_DRAGANDDROP | - |
68 | | - |
69 | QT_BEGIN_NAMESPACE | - |
70 | | - |
71 | // the universe's only drag manager | - |
72 | QDragManager *QDragManager::m_instance = 0; | - |
73 | | - |
74 | | - |
75 | QDragManager::QDragManager() | - |
76 | : QObject(qApp), m_platformDropData(0), m_currentDropTarget(0), | - |
77 | m_platformDrag(QGuiApplicationPrivate::platformIntegration()->drag()), | - |
78 | m_object(0) | - |
79 | { | - |
80 | Q_ASSERT(!m_instance); executed (the execution status of this line is deduced): qt_noop(); | - |
81 | | - |
82 | if (m_platformDrag) partially evaluated: m_platformDrag yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
83 | m_platformDropData = m_platformDrag->platformDropData(); executed: m_platformDropData = m_platformDrag->platformDropData(); Execution Count:5 | 5 |
84 | } executed: } Execution Count:5 | 5 |
85 | | - |
86 | | - |
87 | QDragManager::~QDragManager() | - |
88 | { | - |
89 | m_instance = 0; executed (the execution status of this line is deduced): m_instance = 0; | - |
90 | } executed: } Execution Count:5 | 5 |
91 | | - |
92 | QDragManager *QDragManager::self() | - |
93 | { | - |
94 | if (!m_instance && !QGuiApplication::closingDown()) evaluated: !m_instance yes Evaluation Count:213 | yes Evaluation Count:78 |
evaluated: !QGuiApplication::closingDown() yes Evaluation Count:5 | yes Evaluation Count:208 |
| 5-213 |
95 | m_instance = new QDragManager; executed: m_instance = new QDragManager; Execution Count:5 | 5 |
96 | return m_instance; executed: return m_instance; Execution Count:291 | 291 |
97 | } | - |
98 | | - |
99 | QObject *QDragManager::source() const | - |
100 | { | - |
101 | if (m_object) never evaluated: m_object | 0 |
102 | return m_object->source(); never executed: return m_object->source(); | 0 |
103 | return 0; never executed: return 0; | 0 |
104 | } | - |
105 | | - |
106 | void QDragManager::setCurrentTarget(QObject *target, bool dropped) | - |
107 | { | - |
108 | if (m_currentDropTarget == target) partially evaluated: m_currentDropTarget == target no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
109 | return; | 0 |
110 | | - |
111 | m_currentDropTarget = target; executed (the execution status of this line is deduced): m_currentDropTarget = target; | - |
112 | if (!dropped && m_object) { evaluated: !dropped yes Evaluation Count:4 | yes Evaluation Count:2 |
partially evaluated: m_object no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
113 | m_object->d_func()->target = target; never executed (the execution status of this line is deduced): m_object->d_func()->target = target; | - |
114 | emit m_object->targetChanged(target); never executed (the execution status of this line is deduced): m_object->targetChanged(target); | - |
115 | } | 0 |
116 | } executed: } Execution Count:6 | 6 |
117 | | - |
118 | QObject *QDragManager::currentTarget() const | - |
119 | { | - |
120 | return m_currentDropTarget; executed: return m_currentDropTarget; Execution Count:8 | 8 |
121 | } | - |
122 | | - |
123 | Qt::DropAction QDragManager::drag(QDrag *o) | - |
124 | { | - |
125 | if (!o || m_object == o) never evaluated: !o never evaluated: m_object == o | 0 |
126 | return Qt::IgnoreAction; never executed: return Qt::IgnoreAction; | 0 |
127 | | - |
128 | if (!m_platformDrag || !o->source()) { never evaluated: !m_platformDrag never evaluated: !o->source() | 0 |
129 | o->deleteLater(); never executed (the execution status of this line is deduced): o->deleteLater(); | - |
130 | return Qt::IgnoreAction; never executed: return Qt::IgnoreAction; | 0 |
131 | } | - |
132 | | - |
133 | if (m_object) { never evaluated: m_object | 0 |
134 | qWarning("QDragManager::drag in possibly invalid state"); never executed (the execution status of this line is deduced): QMessageLogger("kernel/qdnd.cpp", 134, __PRETTY_FUNCTION__).warning("QDragManager::drag in possibly invalid state"); | - |
135 | return Qt::IgnoreAction; never executed: return Qt::IgnoreAction; | 0 |
136 | } | - |
137 | | - |
138 | m_object = o; never executed (the execution status of this line is deduced): m_object = o; | - |
139 | | - |
140 | m_object->d_func()->target = 0; never executed (the execution status of this line is deduced): m_object->d_func()->target = 0; | - |
141 | | - |
142 | QGuiApplicationPrivate::instance()->notifyDragStarted(o); never executed (the execution status of this line is deduced): QGuiApplicationPrivate::instance()->notifyDragStarted(o); | - |
143 | const Qt::DropAction result = m_platformDrag->drag(m_object); never executed (the execution status of this line is deduced): const Qt::DropAction result = m_platformDrag->drag(m_object); | - |
144 | m_object = 0; never executed (the execution status of this line is deduced): m_object = 0; | - |
145 | return result; never executed: return result; | 0 |
146 | } | - |
147 | | - |
148 | #endif // QT_NO_DRAGANDDROP | - |
149 | | - |
150 | #if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD)) | - |
151 | | - |
152 | static QStringList imageReadMimeFormats() | - |
153 | { | - |
154 | QStringList formats; executed (the execution status of this line is deduced): QStringList formats; | - |
155 | QList<QByteArray> imageFormats = QImageReader::supportedImageFormats(); executed (the execution status of this line is deduced): QList<QByteArray> imageFormats = QImageReader::supportedImageFormats(); | - |
156 | for (int i = 0; i < imageFormats.size(); ++i) { evaluated: i < imageFormats.size() yes Evaluation Count:154 | yes Evaluation Count:14 |
| 14-154 |
157 | QString format = QLatin1String("image/"); executed (the execution status of this line is deduced): QString format = QLatin1String("image/"); | - |
158 | format += QString::fromLatin1(imageFormats.at(i).toLower()); executed (the execution status of this line is deduced): format += QString::fromLatin1(imageFormats.at(i).toLower()); | - |
159 | formats.append(format); executed (the execution status of this line is deduced): formats.append(format); | - |
160 | } executed: } Execution Count:154 | 154 |
161 | | - |
162 | //put png at the front because it is best | - |
163 | int pngIndex = formats.indexOf(QLatin1String("image/png")); executed (the execution status of this line is deduced): int pngIndex = formats.indexOf(QLatin1String("image/png")); | - |
164 | if (pngIndex != -1 && pngIndex != 0) partially evaluated: pngIndex != -1 yes Evaluation Count:14 | no Evaluation Count:0 |
partially evaluated: pngIndex != 0 yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
165 | formats.move(pngIndex, 0); executed: formats.move(pngIndex, 0); Execution Count:14 | 14 |
166 | | - |
167 | return formats; executed: return formats; Execution Count:14 | 14 |
168 | } | - |
169 | | - |
170 | | - |
171 | static QStringList imageWriteMimeFormats() | - |
172 | { | - |
173 | QStringList formats; never executed (the execution status of this line is deduced): QStringList formats; | - |
174 | QList<QByteArray> imageFormats = QImageWriter::supportedImageFormats(); never executed (the execution status of this line is deduced): QList<QByteArray> imageFormats = QImageWriter::supportedImageFormats(); | - |
175 | for (int i = 0; i < imageFormats.size(); ++i) { never evaluated: i < imageFormats.size() | 0 |
176 | QString format = QLatin1String("image/"); never executed (the execution status of this line is deduced): QString format = QLatin1String("image/"); | - |
177 | format += QString::fromLatin1(imageFormats.at(i).toLower()); never executed (the execution status of this line is deduced): format += QString::fromLatin1(imageFormats.at(i).toLower()); | - |
178 | formats.append(format); never executed (the execution status of this line is deduced): formats.append(format); | - |
179 | } | 0 |
180 | | - |
181 | //put png at the front because it is best | - |
182 | int pngIndex = formats.indexOf(QLatin1String("image/png")); never executed (the execution status of this line is deduced): int pngIndex = formats.indexOf(QLatin1String("image/png")); | - |
183 | if (pngIndex != -1 && pngIndex != 0) never evaluated: pngIndex != -1 never evaluated: pngIndex != 0 | 0 |
184 | formats.move(pngIndex, 0); never executed: formats.move(pngIndex, 0); | 0 |
185 | | - |
186 | return formats; never executed: return formats; | 0 |
187 | } | - |
188 | | - |
189 | QInternalMimeData::QInternalMimeData() | - |
190 | : QMimeData() | - |
191 | { | - |
192 | } executed: } Execution Count:292 | 292 |
193 | | - |
194 | QInternalMimeData::~QInternalMimeData() | - |
195 | { | - |
196 | } | - |
197 | | - |
198 | bool QInternalMimeData::hasFormat(const QString &mimeType) const | - |
199 | { | - |
200 | bool foundFormat = hasFormat_sys(mimeType); executed (the execution status of this line is deduced): bool foundFormat = hasFormat_sys(mimeType); | - |
201 | if (!foundFormat && mimeType == QLatin1String("application/x-qt-image")) { partially evaluated: !foundFormat yes Evaluation Count:14 | no Evaluation Count:0 |
partially evaluated: mimeType == QLatin1String("application/x-qt-image") no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
202 | QStringList imageFormats = imageReadMimeFormats(); never executed (the execution status of this line is deduced): QStringList imageFormats = imageReadMimeFormats(); | - |
203 | for (int i = 0; i < imageFormats.size(); ++i) { never evaluated: i < imageFormats.size() | 0 |
204 | if ((foundFormat = hasFormat_sys(imageFormats.at(i)))) never evaluated: (foundFormat = hasFormat_sys(imageFormats.at(i))) | 0 |
205 | break; | 0 |
206 | } | 0 |
207 | } | 0 |
208 | return foundFormat; executed: return foundFormat; Execution Count:14 | 14 |
209 | } | - |
210 | | - |
211 | QStringList QInternalMimeData::formats() const | - |
212 | { | - |
213 | QStringList realFormats = formats_sys(); executed (the execution status of this line is deduced): QStringList realFormats = formats_sys(); | - |
214 | if (!realFormats.contains(QLatin1String("application/x-qt-image"))) { partially evaluated: !realFormats.contains(QLatin1String("application/x-qt-image")) yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
215 | QStringList imageFormats = imageReadMimeFormats(); executed (the execution status of this line is deduced): QStringList imageFormats = imageReadMimeFormats(); | - |
216 | for (int i = 0; i < imageFormats.size(); ++i) { evaluated: i < imageFormats.size() yes Evaluation Count:154 | yes Evaluation Count:14 |
| 14-154 |
217 | if (realFormats.contains(imageFormats.at(i))) { partially evaluated: realFormats.contains(imageFormats.at(i)) no Evaluation Count:0 | yes Evaluation Count:154 |
| 0-154 |
218 | realFormats += QLatin1String("application/x-qt-image"); never executed (the execution status of this line is deduced): realFormats += QLatin1String("application/x-qt-image"); | - |
219 | break; | 0 |
220 | } | - |
221 | } executed: } Execution Count:154 | 154 |
222 | } executed: } Execution Count:14 | 14 |
223 | return realFormats; executed: return realFormats; Execution Count:14 | 14 |
224 | } | - |
225 | | - |
226 | QVariant QInternalMimeData::retrieveData(const QString &mimeType, QVariant::Type type) const | - |
227 | { | - |
228 | QVariant data = retrieveData_sys(mimeType, type); executed (the execution status of this line is deduced): QVariant data = retrieveData_sys(mimeType, type); | - |
229 | if (mimeType == QLatin1String("application/x-qt-image")) { partially evaluated: mimeType == QLatin1String("application/x-qt-image") no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
230 | if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty())) { never evaluated: data.isNull() never evaluated: data.type() == QVariant::ByteArray never evaluated: data.toByteArray().isEmpty() | 0 |
231 | // try to find an image | - |
232 | QStringList imageFormats = imageReadMimeFormats(); never executed (the execution status of this line is deduced): QStringList imageFormats = imageReadMimeFormats(); | - |
233 | for (int i = 0; i < imageFormats.size(); ++i) { never evaluated: i < imageFormats.size() | 0 |
234 | data = retrieveData_sys(imageFormats.at(i), type); never executed (the execution status of this line is deduced): data = retrieveData_sys(imageFormats.at(i), type); | - |
235 | if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty())) never evaluated: data.isNull() never evaluated: data.type() == QVariant::ByteArray never evaluated: data.toByteArray().isEmpty() | 0 |
236 | continue; never executed: continue; | 0 |
237 | break; | 0 |
238 | } | - |
239 | } | 0 |
240 | // we wanted some image type, but all we got was a byte array. Convert it to an image. | - |
241 | if (data.type() == QVariant::ByteArray never evaluated: data.type() == QVariant::ByteArray | 0 |
242 | && (type == QVariant::Image || type == QVariant::Pixmap || type == QVariant::Bitmap)) never evaluated: type == QVariant::Image never evaluated: type == QVariant::Pixmap never evaluated: type == QVariant::Bitmap | 0 |
243 | data = QImage::fromData(data.toByteArray()); never executed: data = QImage::fromData(data.toByteArray()); | 0 |
244 | | - |
245 | } else if (mimeType == QLatin1String("application/x-color") && data.type() == QVariant::ByteArray) { never executed: } partially evaluated: mimeType == QLatin1String("application/x-color") no Evaluation Count:0 | yes Evaluation Count:4 |
never evaluated: data.type() == QVariant::ByteArray | 0-4 |
246 | QColor c; never executed (the execution status of this line is deduced): QColor c; | - |
247 | QByteArray ba = data.toByteArray(); never executed (the execution status of this line is deduced): QByteArray ba = data.toByteArray(); | - |
248 | if (ba.size() == 8) { never evaluated: ba.size() == 8 | 0 |
249 | ushort * colBuf = (ushort *)ba.data(); never executed (the execution status of this line is deduced): ushort * colBuf = (ushort *)ba.data(); | - |
250 | c.setRgbF(qreal(colBuf[0]) / qreal(0xFFFF), never executed (the execution status of this line is deduced): c.setRgbF(qreal(colBuf[0]) / qreal(0xFFFF), | - |
251 | qreal(colBuf[1]) / qreal(0xFFFF), never executed (the execution status of this line is deduced): qreal(colBuf[1]) / qreal(0xFFFF), | - |
252 | qreal(colBuf[2]) / qreal(0xFFFF), never executed (the execution status of this line is deduced): qreal(colBuf[2]) / qreal(0xFFFF), | - |
253 | qreal(colBuf[3]) / qreal(0xFFFF)); never executed (the execution status of this line is deduced): qreal(colBuf[3]) / qreal(0xFFFF)); | - |
254 | data = c; never executed (the execution status of this line is deduced): data = c; | - |
255 | } else { | 0 |
256 | qWarning("Qt: Invalid color format"); never executed (the execution status of this line is deduced): QMessageLogger("kernel/qdnd.cpp", 256, __PRETTY_FUNCTION__).warning("Qt: Invalid color format"); | - |
257 | } | 0 |
258 | } else if (data.type() != type && data.type() == QVariant::ByteArray) { partially evaluated: data.type() != type yes Evaluation Count:4 | no Evaluation Count:0 |
partially evaluated: data.type() == QVariant::ByteArray yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
259 | // try to use mime data's internal conversion stuf. | - |
260 | QInternalMimeData *that = const_cast<QInternalMimeData *>(this); executed (the execution status of this line is deduced): QInternalMimeData *that = const_cast<QInternalMimeData *>(this); | - |
261 | that->setData(mimeType, data.toByteArray()); executed (the execution status of this line is deduced): that->setData(mimeType, data.toByteArray()); | - |
262 | data = QMimeData::retrieveData(mimeType, type); executed (the execution status of this line is deduced): data = QMimeData::retrieveData(mimeType, type); | - |
263 | that->clear(); executed (the execution status of this line is deduced): that->clear(); | - |
264 | } executed: } Execution Count:4 | 4 |
265 | return data; executed: return data; Execution Count:4 | 4 |
266 | } | - |
267 | | - |
268 | bool QInternalMimeData::canReadData(const QString &mimeType) | - |
269 | { | - |
270 | return imageReadMimeFormats().contains(mimeType); never executed: return imageReadMimeFormats().contains(mimeType); | 0 |
271 | } | - |
272 | | - |
273 | // helper functions for rendering mimedata to the system, this is needed because QMimeData is in core. | - |
274 | QStringList QInternalMimeData::formatsHelper(const QMimeData *data) | - |
275 | { | - |
276 | QStringList realFormats = data->formats(); never executed (the execution status of this line is deduced): QStringList realFormats = data->formats(); | - |
277 | if (realFormats.contains(QLatin1String("application/x-qt-image"))) { never evaluated: realFormats.contains(QLatin1String("application/x-qt-image")) | 0 |
278 | // add all supported image formats | - |
279 | QStringList imageFormats = imageWriteMimeFormats(); never executed (the execution status of this line is deduced): QStringList imageFormats = imageWriteMimeFormats(); | - |
280 | for (int i = 0; i < imageFormats.size(); ++i) { never evaluated: i < imageFormats.size() | 0 |
281 | if (!realFormats.contains(imageFormats.at(i))) never evaluated: !realFormats.contains(imageFormats.at(i)) | 0 |
282 | realFormats.append(imageFormats.at(i)); never executed: realFormats.append(imageFormats.at(i)); | 0 |
283 | } | 0 |
284 | } | 0 |
285 | return realFormats; never executed: return realFormats; | 0 |
286 | } | - |
287 | | - |
288 | bool QInternalMimeData::hasFormatHelper(const QString &mimeType, const QMimeData *data) | - |
289 | { | - |
290 | | - |
291 | bool foundFormat = data->hasFormat(mimeType); executed (the execution status of this line is deduced): bool foundFormat = data->hasFormat(mimeType); | - |
292 | if (!foundFormat) { partially evaluated: !foundFormat no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
293 | if (mimeType == QLatin1String("application/x-qt-image")) { never evaluated: mimeType == QLatin1String("application/x-qt-image") | 0 |
294 | // check all supported image formats | - |
295 | QStringList imageFormats = imageWriteMimeFormats(); never executed (the execution status of this line is deduced): QStringList imageFormats = imageWriteMimeFormats(); | - |
296 | for (int i = 0; i < imageFormats.size(); ++i) { never evaluated: i < imageFormats.size() | 0 |
297 | if ((foundFormat = data->hasFormat(imageFormats.at(i)))) never evaluated: (foundFormat = data->hasFormat(imageFormats.at(i))) | 0 |
298 | break; | 0 |
299 | } | 0 |
300 | } else if (mimeType.startsWith(QLatin1String("image/"))) { never executed: } never evaluated: mimeType.startsWith(QLatin1String("image/")) | 0 |
301 | return data->hasImage() && imageWriteMimeFormats().contains(mimeType); never executed: return data->hasImage() && imageWriteMimeFormats().contains(mimeType); | 0 |
302 | } | - |
303 | } | - |
304 | return foundFormat; executed: return foundFormat; Execution Count:8 | 8 |
305 | } | - |
306 | | - |
307 | QByteArray QInternalMimeData::renderDataHelper(const QString &mimeType, const QMimeData *data) | - |
308 | { | - |
309 | QByteArray ba; executed (the execution status of this line is deduced): QByteArray ba; | - |
310 | if (mimeType == QLatin1String("application/x-color")) { partially evaluated: mimeType == QLatin1String("application/x-color") no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
311 | /* QMimeData can only provide colors as QColor or the name | - |
312 | of a color as a QByteArray or a QString. So we need to do | - |
313 | the conversion to application/x-color here. | - |
314 | The application/x-color format is : | - |
315 | type: application/x-color | - |
316 | format: 16 | - |
317 | data[0]: red | - |
318 | data[1]: green | - |
319 | data[2]: blue | - |
320 | data[3]: opacity | - |
321 | */ | - |
322 | ba.resize(8); never executed (the execution status of this line is deduced): ba.resize(8); | - |
323 | ushort * colBuf = (ushort *)ba.data(); never executed (the execution status of this line is deduced): ushort * colBuf = (ushort *)ba.data(); | - |
324 | QColor c = qvariant_cast<QColor>(data->colorData()); never executed (the execution status of this line is deduced): QColor c = qvariant_cast<QColor>(data->colorData()); | - |
325 | colBuf[0] = ushort(c.redF() * 0xFFFF); never executed (the execution status of this line is deduced): colBuf[0] = ushort(c.redF() * 0xFFFF); | - |
326 | colBuf[1] = ushort(c.greenF() * 0xFFFF); never executed (the execution status of this line is deduced): colBuf[1] = ushort(c.greenF() * 0xFFFF); | - |
327 | colBuf[2] = ushort(c.blueF() * 0xFFFF); never executed (the execution status of this line is deduced): colBuf[2] = ushort(c.blueF() * 0xFFFF); | - |
328 | colBuf[3] = ushort(c.alphaF() * 0xFFFF); never executed (the execution status of this line is deduced): colBuf[3] = ushort(c.alphaF() * 0xFFFF); | - |
329 | } else { | 0 |
330 | ba = data->data(mimeType); executed (the execution status of this line is deduced): ba = data->data(mimeType); | - |
331 | if (ba.isEmpty()) { evaluated: ba.isEmpty() yes Evaluation Count:1 | yes Evaluation Count:7 |
| 1-7 |
332 | if (mimeType == QLatin1String("application/x-qt-image") && data->hasImage()) { partially evaluated: mimeType == QLatin1String("application/x-qt-image") no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: data->hasImage() | 0-1 |
333 | QImage image = qvariant_cast<QImage>(data->imageData()); never executed (the execution status of this line is deduced): QImage image = qvariant_cast<QImage>(data->imageData()); | - |
334 | QBuffer buf(&ba); never executed (the execution status of this line is deduced): QBuffer buf(&ba); | - |
335 | buf.open(QBuffer::WriteOnly); never executed (the execution status of this line is deduced): buf.open(QBuffer::WriteOnly); | - |
336 | // would there not be PNG ?? | - |
337 | image.save(&buf, "PNG"); never executed (the execution status of this line is deduced): image.save(&buf, "PNG"); | - |
338 | } else if (mimeType.startsWith(QLatin1String("image/")) && data->hasImage()) { never executed: } partially evaluated: mimeType.startsWith(QLatin1String("image/")) no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: data->hasImage() | 0-1 |
339 | QImage image = qvariant_cast<QImage>(data->imageData()); never executed (the execution status of this line is deduced): QImage image = qvariant_cast<QImage>(data->imageData()); | - |
340 | QBuffer buf(&ba); never executed (the execution status of this line is deduced): QBuffer buf(&ba); | - |
341 | buf.open(QBuffer::WriteOnly); never executed (the execution status of this line is deduced): buf.open(QBuffer::WriteOnly); | - |
342 | image.save(&buf, mimeType.mid(mimeType.indexOf(QLatin1Char('/')) + 1).toLatin1().toUpper()); never executed (the execution status of this line is deduced): image.save(&buf, mimeType.mid(mimeType.indexOf(QLatin1Char('/')) + 1).toLatin1().toUpper()); | - |
343 | } | 0 |
344 | } | - |
345 | } executed: } Execution Count:8 | 8 |
346 | return ba; executed: return ba; Execution Count:8 | 8 |
347 | } | - |
348 | | - |
349 | #endif // QT_NO_DRAGANDDROP && QT_NO_CLIPBOARD | - |
350 | | - |
351 | QT_END_NAMESPACE | - |
352 | | - |
| | |