| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickdroparea.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||||||||||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||||||||
| 6 | ** This file is part of the QtQuick 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 The Qt Company. For licensing terms | - | ||||||||||||||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||
| 15 | ** information use the contact form at https://www.qt.io/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 3 as published by the Free Software | - | ||||||||||||||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||||||||
| 24 | ** | - | ||||||||||||||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||||||||
| 35 | ** | - | ||||||||||||||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||
| 37 | ** | - | ||||||||||||||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | #include "qquickdroparea_p.h" | - | ||||||||||||||||||||||||
| 41 | #include "qquickdrag_p.h" | - | ||||||||||||||||||||||||
| 42 | #include "qquickitem_p.h" | - | ||||||||||||||||||||||||
| 43 | - | |||||||||||||||||||||||||
| 44 | #include <private/qv4arraybuffer_p.h> | - | ||||||||||||||||||||||||
| 45 | - | |||||||||||||||||||||||||
| 46 | #if QT_CONFIG(draganddrop) | - | ||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||
| 50 | QQuickDropAreaDrag::QQuickDropAreaDrag(QQuickDropAreaPrivate *d, QObject *parent) | - | ||||||||||||||||||||||||
| 51 | : QObject(parent) | - | ||||||||||||||||||||||||
| 52 | , d(d) | - | ||||||||||||||||||||||||
| 53 | { | - | ||||||||||||||||||||||||
| 54 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | QQuickDropAreaDrag::~QQuickDropAreaDrag() | - | ||||||||||||||||||||||||
| 57 | { | - | ||||||||||||||||||||||||
| 58 | } | - | ||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||
| 60 | class QQuickDropAreaPrivate : public QQuickItemPrivate | - | ||||||||||||||||||||||||
| 61 | { | - | ||||||||||||||||||||||||
| 62 | Q_DECLARE_PUBLIC(QQuickDropArea) | - | ||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||
| 64 | public: | - | ||||||||||||||||||||||||
| 65 | QQuickDropAreaPrivate(); | - | ||||||||||||||||||||||||
| 66 | ~QQuickDropAreaPrivate(); | - | ||||||||||||||||||||||||
| 67 | - | |||||||||||||||||||||||||
| 68 | bool hasMatchingKey(const QStringList &keys) const; | - | ||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||
| 70 | QStringList getKeys(const QMimeData *mimeData) const; | - | ||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||
| 72 | QStringList keys; | - | ||||||||||||||||||||||||
| 73 | QRegExp keyRegExp; | - | ||||||||||||||||||||||||
| 74 | QPointF dragPosition; | - | ||||||||||||||||||||||||
| 75 | QQuickDropAreaDrag *drag; | - | ||||||||||||||||||||||||
| 76 | QPointer<QObject> source; | - | ||||||||||||||||||||||||
| 77 | bool containsDrag; | - | ||||||||||||||||||||||||
| 78 | }; | - | ||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||
| 80 | QQuickDropAreaPrivate::QQuickDropAreaPrivate() | - | ||||||||||||||||||||||||
| 81 | : drag(nullptr) | - | ||||||||||||||||||||||||
| 82 | , containsDrag(false) | - | ||||||||||||||||||||||||
| 83 | { | - | ||||||||||||||||||||||||
| 84 | } executed 214 times by 3 tests: end of blockExecuted by:
| 214 | ||||||||||||||||||||||||
| 85 | - | |||||||||||||||||||||||||
| 86 | QQuickDropAreaPrivate::~QQuickDropAreaPrivate() | - | ||||||||||||||||||||||||
| 87 | { | - | ||||||||||||||||||||||||
| 88 | delete drag; | - | ||||||||||||||||||||||||
| 89 | } executed 214 times by 3 tests: end of blockExecuted by:
| 214 | ||||||||||||||||||||||||
| 90 | - | |||||||||||||||||||||||||
| 91 | /*! | - | ||||||||||||||||||||||||
| 92 | \qmltype DropArea | - | ||||||||||||||||||||||||
| 93 | \instantiates QQuickDropArea | - | ||||||||||||||||||||||||
| 94 | \inqmlmodule QtQuick | - | ||||||||||||||||||||||||
| 95 | \ingroup qtquick-input | - | ||||||||||||||||||||||||
| 96 | \brief For specifying drag and drop handling in an area. | - | ||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||
| 98 | A DropArea is an invisible item which receives events when other items are | - | ||||||||||||||||||||||||
| 99 | dragged over it. | - | ||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||
| 101 | The \l Drag attached property can be used to notify the DropArea when an Item is | - | ||||||||||||||||||||||||
| 102 | dragged over it. | - | ||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||
| 104 | The \l keys property can be used to filter drag events which don't include | - | ||||||||||||||||||||||||
| 105 | a matching key. | - | ||||||||||||||||||||||||
| 106 | - | |||||||||||||||||||||||||
| 107 | The \l drag.source property is communicated to the source of a drag event as | - | ||||||||||||||||||||||||
| 108 | the recipient of a drop on the drag target. | - | ||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||
| 110 | \sa {Qt Quick Examples - Drag and Drop}, {Qt Quick Examples - externaldraganddrop} | - | ||||||||||||||||||||||||
| 111 | */ | - | ||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||
| 113 | QQuickDropArea::QQuickDropArea(QQuickItem *parent) | - | ||||||||||||||||||||||||
| 114 | : QQuickItem(*new QQuickDropAreaPrivate, parent) | - | ||||||||||||||||||||||||
| 115 | { | - | ||||||||||||||||||||||||
| 116 | setFlags(ItemAcceptsDrops); | - | ||||||||||||||||||||||||
| 117 | } executed 214 times by 3 tests: end of blockExecuted by:
| 214 | ||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||
| 119 | QQuickDropArea::~QQuickDropArea() | - | ||||||||||||||||||||||||
| 120 | { | - | ||||||||||||||||||||||||
| 121 | } | - | ||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||
| 123 | /*! | - | ||||||||||||||||||||||||
| 124 | \qmlproperty bool QtQuick::DropArea::containsDrag | - | ||||||||||||||||||||||||
| 125 | - | |||||||||||||||||||||||||
| 126 | This property identifies whether the DropArea currently contains any | - | ||||||||||||||||||||||||
| 127 | dragged items. | - | ||||||||||||||||||||||||
| 128 | */ | - | ||||||||||||||||||||||||
| 129 | - | |||||||||||||||||||||||||
| 130 | bool QQuickDropArea::containsDrag() const | - | ||||||||||||||||||||||||
| 131 | { | - | ||||||||||||||||||||||||
| 132 | Q_D(const QQuickDropArea); | - | ||||||||||||||||||||||||
| 133 | return d->containsDrag; executed 240 times by 2 tests: return d->containsDrag;Executed by:
| 240 | ||||||||||||||||||||||||
| 134 | } | - | ||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||
| 136 | /*! | - | ||||||||||||||||||||||||
| 137 | \qmlproperty stringlist QtQuick::DropArea::keys | - | ||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||
| 139 | This property holds a list of drag keys a DropArea will accept. | - | ||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||
| 141 | If no keys are listed the DropArea will accept events from any drag source, | - | ||||||||||||||||||||||||
| 142 | otherwise the drag source must have at least one compatible key. | - | ||||||||||||||||||||||||
| 143 | - | |||||||||||||||||||||||||
| 144 | \sa QtQuick::Drag::keys | - | ||||||||||||||||||||||||
| 145 | */ | - | ||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||
| 147 | QStringList QQuickDropArea::keys() const | - | ||||||||||||||||||||||||
| 148 | { | - | ||||||||||||||||||||||||
| 149 | Q_D(const QQuickDropArea); | - | ||||||||||||||||||||||||
| 150 | return d->keys; executed 46 times by 1 test: return d->keys;Executed by:
| 46 | ||||||||||||||||||||||||
| 151 | } | - | ||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||
| 153 | void QQuickDropArea::setKeys(const QStringList &keys) | - | ||||||||||||||||||||||||
| 154 | { | - | ||||||||||||||||||||||||
| 155 | Q_D(QQuickDropArea); | - | ||||||||||||||||||||||||
| 156 | if (d->keys != keys) {
| 2-60 | ||||||||||||||||||||||||
| 157 | d->keys = keys; | - | ||||||||||||||||||||||||
| 158 | - | |||||||||||||||||||||||||
| 159 | if (keys.isEmpty()) {
| 4-56 | ||||||||||||||||||||||||
| 160 | d->keyRegExp = QRegExp(); | - | ||||||||||||||||||||||||
| 161 | } else { executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 162 | QString pattern = QLatin1Char('(') + QRegExp::escape(keys.first()); | - | ||||||||||||||||||||||||
| 163 | for (int i = 1; i < keys.count(); ++i)
| 8-56 | ||||||||||||||||||||||||
| 164 | pattern += QLatin1Char('|') + QRegExp::escape(keys.at(i)); executed 8 times by 1 test: pattern += QLatin1Char('|') + QRegExp::escape(keys.at(i));Executed by:
| 8 | ||||||||||||||||||||||||
| 165 | pattern += QLatin1Char(')'); | - | ||||||||||||||||||||||||
| 166 | d->keyRegExp = QRegExp(pattern.replace(QLatin1String("\\*"), QLatin1String(".+"))); | - | ||||||||||||||||||||||||
| 167 | } executed 56 times by 2 tests: end of blockExecuted by:
| 56 | ||||||||||||||||||||||||
| 168 | emit keysChanged(); | - | ||||||||||||||||||||||||
| 169 | } executed 60 times by 2 tests: end of blockExecuted by:
| 60 | ||||||||||||||||||||||||
| 170 | } executed 62 times by 2 tests: end of blockExecuted by:
| 62 | ||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||
| 172 | QQuickDropAreaDrag *QQuickDropArea::drag() | - | ||||||||||||||||||||||||
| 173 | { | - | ||||||||||||||||||||||||
| 174 | Q_D(QQuickDropArea); | - | ||||||||||||||||||||||||
| 175 | if (!d->drag)
| 6-74 | ||||||||||||||||||||||||
| 176 | d->drag = new QQuickDropAreaDrag(d); executed 6 times by 1 test: d->drag = new QQuickDropAreaDrag(d);Executed by:
| 6 | ||||||||||||||||||||||||
| 177 | return d->drag; executed 80 times by 1 test: return d->drag;Executed by:
| 80 | ||||||||||||||||||||||||
| 178 | } | - | ||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||
| 180 | /*! | - | ||||||||||||||||||||||||
| 181 | \qmlproperty Object QtQuick::DropArea::drag.source | - | ||||||||||||||||||||||||
| 182 | - | |||||||||||||||||||||||||
| 183 | This property holds the source of a drag. | - | ||||||||||||||||||||||||
| 184 | */ | - | ||||||||||||||||||||||||
| 185 | - | |||||||||||||||||||||||||
| 186 | QObject *QQuickDropAreaDrag::source() const | - | ||||||||||||||||||||||||
| 187 | { | - | ||||||||||||||||||||||||
| 188 | return d->source; executed 20 times by 1 test: return d->source;Executed by:
| 20 | ||||||||||||||||||||||||
| 189 | } | - | ||||||||||||||||||||||||
| 190 | - | |||||||||||||||||||||||||
| 191 | /*! | - | ||||||||||||||||||||||||
| 192 | \qmlpropertygroup QtQuick::DropArea::drag | - | ||||||||||||||||||||||||
| 193 | \qmlproperty qreal QtQuick::DropArea::drag.x | - | ||||||||||||||||||||||||
| 194 | \qmlproperty qreal QtQuick::DropArea::drag.y | - | ||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||
| 196 | These properties hold the coordinates of the last drag event. | - | ||||||||||||||||||||||||
| 197 | */ | - | ||||||||||||||||||||||||
| 198 | - | |||||||||||||||||||||||||
| 199 | qreal QQuickDropAreaDrag::x() const | - | ||||||||||||||||||||||||
| 200 | { | - | ||||||||||||||||||||||||
| 201 | return d->dragPosition.x(); executed 30 times by 1 test: return d->dragPosition.x();Executed by:
| 30 | ||||||||||||||||||||||||
| 202 | } | - | ||||||||||||||||||||||||
| 203 | - | |||||||||||||||||||||||||
| 204 | qreal QQuickDropAreaDrag::y() const | - | ||||||||||||||||||||||||
| 205 | { | - | ||||||||||||||||||||||||
| 206 | return d->dragPosition.y(); executed 30 times by 1 test: return d->dragPosition.y();Executed by:
| 30 | ||||||||||||||||||||||||
| 207 | } | - | ||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||
| 209 | /*! | - | ||||||||||||||||||||||||
| 210 | \qmlsignal QtQuick::DropArea::positionChanged(DragEvent drag) | - | ||||||||||||||||||||||||
| 211 | - | |||||||||||||||||||||||||
| 212 | This signal is emitted when the position of a drag has changed. | - | ||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||
| 214 | The corresponding handler is \c onPositionChanged. | - | ||||||||||||||||||||||||
| 215 | */ | - | ||||||||||||||||||||||||
| 216 | - | |||||||||||||||||||||||||
| 217 | void QQuickDropArea::dragMoveEvent(QDragMoveEvent *event) | - | ||||||||||||||||||||||||
| 218 | { | - | ||||||||||||||||||||||||
| 219 | Q_D(QQuickDropArea); | - | ||||||||||||||||||||||||
| 220 | if (!d->containsDrag)
| 0-140 | ||||||||||||||||||||||||
| 221 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 222 | - | |||||||||||||||||||||||||
| 223 | d->dragPosition = event->pos(); | - | ||||||||||||||||||||||||
| 224 | if (d->drag)
| 10-130 | ||||||||||||||||||||||||
| 225 | emit d->drag->positionChanged(); executed 10 times by 1 test: d->drag->positionChanged();Executed by:
| 10 | ||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||
| 227 | event->accept(); | - | ||||||||||||||||||||||||
| 228 | QQuickDropEvent dragTargetEvent(d, event); | - | ||||||||||||||||||||||||
| 229 | emit positionChanged(&dragTargetEvent); | - | ||||||||||||||||||||||||
| 230 | } executed 140 times by 2 tests: end of blockExecuted by:
| 140 | ||||||||||||||||||||||||
| 231 | - | |||||||||||||||||||||||||
| 232 | bool QQuickDropAreaPrivate::hasMatchingKey(const QStringList &keys) const | - | ||||||||||||||||||||||||
| 233 | { | - | ||||||||||||||||||||||||
| 234 | if (keyRegExp.isEmpty())
| 58-64 | ||||||||||||||||||||||||
| 235 | return true; executed 64 times by 2 tests: return true;Executed by:
| 64 | ||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | QRegExp copy = keyRegExp; | - | ||||||||||||||||||||||||
| 238 | for (const QString &key : keys) { | - | ||||||||||||||||||||||||
| 239 | if (copy.exactMatch(key))
| 26-42 | ||||||||||||||||||||||||
| 240 | return true; executed 42 times by 1 test: return true;Executed by:
| 42 | ||||||||||||||||||||||||
| 241 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||
| 242 | return false; executed 16 times by 1 test: return false;Executed by:
| 16 | ||||||||||||||||||||||||
| 243 | } | - | ||||||||||||||||||||||||
| 244 | - | |||||||||||||||||||||||||
| 245 | QStringList QQuickDropAreaPrivate::getKeys(const QMimeData *mimeData) const | - | ||||||||||||||||||||||||
| 246 | { | - | ||||||||||||||||||||||||
| 247 | if (const QQuickDragMimeData *dragMime = qobject_cast<const QQuickDragMimeData *>(mimeData))
| 50-98 | ||||||||||||||||||||||||
| 248 | return dragMime->keys(); executed 98 times by 2 tests: return dragMime->keys();Executed by:
| 98 | ||||||||||||||||||||||||
| 249 | return mimeData->formats(); executed 50 times by 1 test: return mimeData->formats();Executed by:
| 50 | ||||||||||||||||||||||||
| 250 | } | - | ||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | /*! | - | ||||||||||||||||||||||||
| 253 | \qmlsignal QtQuick::DropArea::entered(DragEvent drag) | - | ||||||||||||||||||||||||
| 254 | - | |||||||||||||||||||||||||
| 255 | This signal is emitted when a \a drag enters the bounds of a DropArea. | - | ||||||||||||||||||||||||
| 256 | - | |||||||||||||||||||||||||
| 257 | The corresponding handler is \c onEntered. | - | ||||||||||||||||||||||||
| 258 | */ | - | ||||||||||||||||||||||||
| 259 | - | |||||||||||||||||||||||||
| 260 | void QQuickDropArea::dragEnterEvent(QDragEnterEvent *event) | - | ||||||||||||||||||||||||
| 261 | { | - | ||||||||||||||||||||||||
| 262 | Q_D(QQuickDropArea); | - | ||||||||||||||||||||||||
| 263 | const QMimeData *mimeData = event->mimeData(); | - | ||||||||||||||||||||||||
| 264 | if (!d->effectiveEnable || d->containsDrag || !mimeData || !d->hasMatchingKey(d->getKeys(mimeData)))
| 0-138 | ||||||||||||||||||||||||
| 265 | return; executed 32 times by 1 test: return;Executed by:
| 32 | ||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||
| 267 | d->dragPosition = event->pos(); | - | ||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||
| 269 | event->accept(); | - | ||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||
| 271 | QQuickDropEvent dragTargetEvent(d, event); | - | ||||||||||||||||||||||||
| 272 | emit entered(&dragTargetEvent); | - | ||||||||||||||||||||||||
| 273 | if (!event->isAccepted())
| 2-104 | ||||||||||||||||||||||||
| 274 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||||||||
| 275 | - | |||||||||||||||||||||||||
| 276 | d->containsDrag = true; | - | ||||||||||||||||||||||||
| 277 | if (QQuickDragMimeData *dragMime = qobject_cast<QQuickDragMimeData *>(const_cast<QMimeData *>(mimeData)))
| 30-74 | ||||||||||||||||||||||||
| 278 | d->source = dragMime->source(); executed 74 times by 2 tests: d->source = dragMime->source();Executed by:
| 74 | ||||||||||||||||||||||||
| 279 | else | - | ||||||||||||||||||||||||
| 280 | d->source = event->source(); executed 30 times by 1 test: d->source = event->source();Executed by:
| 30 | ||||||||||||||||||||||||
| 281 | d->dragPosition = event->pos(); | - | ||||||||||||||||||||||||
| 282 | if (d->drag) {
| 8-96 | ||||||||||||||||||||||||
| 283 | emit d->drag->positionChanged(); | - | ||||||||||||||||||||||||
| 284 | emit d->drag->sourceChanged(); | - | ||||||||||||||||||||||||
| 285 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 286 | emit containsDragChanged(); | - | ||||||||||||||||||||||||
| 287 | } executed 104 times by 2 tests: end of blockExecuted by:
| 104 | ||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||
| 289 | /*! | - | ||||||||||||||||||||||||
| 290 | \qmlsignal QtQuick::DropArea::exited() | - | ||||||||||||||||||||||||
| 291 | - | |||||||||||||||||||||||||
| 292 | This signal is emitted when a drag exits the bounds of a DropArea. | - | ||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||
| 294 | The corresponding handler is \c onExited. | - | ||||||||||||||||||||||||
| 295 | */ | - | ||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||
| 297 | void QQuickDropArea::dragLeaveEvent(QDragLeaveEvent *) | - | ||||||||||||||||||||||||
| 298 | { | - | ||||||||||||||||||||||||
| 299 | Q_D(QQuickDropArea); | - | ||||||||||||||||||||||||
| 300 | if (!d->containsDrag)
| 0-72 | ||||||||||||||||||||||||
| 301 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 302 | - | |||||||||||||||||||||||||
| 303 | emit exited(); | - | ||||||||||||||||||||||||
| 304 | - | |||||||||||||||||||||||||
| 305 | d->containsDrag = false; | - | ||||||||||||||||||||||||
| 306 | d->source = nullptr; | - | ||||||||||||||||||||||||
| 307 | emit containsDragChanged(); | - | ||||||||||||||||||||||||
| 308 | if (d->drag)
| 6-66 | ||||||||||||||||||||||||
| 309 | emit d->drag->sourceChanged(); executed 6 times by 1 test: d->drag->sourceChanged();Executed by:
| 6 | ||||||||||||||||||||||||
| 310 | } executed 72 times by 2 tests: end of blockExecuted by:
| 72 | ||||||||||||||||||||||||
| 311 | - | |||||||||||||||||||||||||
| 312 | /*! | - | ||||||||||||||||||||||||
| 313 | \qmlsignal QtQuick::DropArea::dropped(DragEvent drop) | - | ||||||||||||||||||||||||
| 314 | - | |||||||||||||||||||||||||
| 315 | This signal is emitted when a drop event occurs within the bounds of | - | ||||||||||||||||||||||||
| 316 | a DropArea. | - | ||||||||||||||||||||||||
| 317 | - | |||||||||||||||||||||||||
| 318 | The corresponding handler is \c onDropped. | - | ||||||||||||||||||||||||
| 319 | */ | - | ||||||||||||||||||||||||
| 320 | - | |||||||||||||||||||||||||
| 321 | void QQuickDropArea::dropEvent(QDropEvent *event) | - | ||||||||||||||||||||||||
| 322 | { | - | ||||||||||||||||||||||||
| 323 | Q_D(QQuickDropArea); | - | ||||||||||||||||||||||||
| 324 | if (!d->containsDrag)
| 0-28 | ||||||||||||||||||||||||
| 325 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 326 | - | |||||||||||||||||||||||||
| 327 | QQuickDropEvent dragTargetEvent(d, event); | - | ||||||||||||||||||||||||
| 328 | emit dropped(&dragTargetEvent); | - | ||||||||||||||||||||||||
| 329 | - | |||||||||||||||||||||||||
| 330 | d->containsDrag = false; | - | ||||||||||||||||||||||||
| 331 | d->source = nullptr; | - | ||||||||||||||||||||||||
| 332 | emit containsDragChanged(); | - | ||||||||||||||||||||||||
| 333 | if (d->drag)
| 2-26 | ||||||||||||||||||||||||
| 334 | emit d->drag->sourceChanged(); executed 2 times by 1 test: d->drag->sourceChanged();Executed by:
| 2 | ||||||||||||||||||||||||
| 335 | } executed 28 times by 1 test: end of blockExecuted by:
| 28 | ||||||||||||||||||||||||
| 336 | - | |||||||||||||||||||||||||
| 337 | /*! | - | ||||||||||||||||||||||||
| 338 | \qmltype DragEvent | - | ||||||||||||||||||||||||
| 339 | \instantiates QQuickDropEvent | - | ||||||||||||||||||||||||
| 340 | \inqmlmodule QtQuick | - | ||||||||||||||||||||||||
| 341 | \ingroup qtquick-input-events | - | ||||||||||||||||||||||||
| 342 | \brief Provides information about a drag event. | - | ||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||
| 344 | The position of the drag event can be obtained from the \l x and \l y | - | ||||||||||||||||||||||||
| 345 | properties, and the \l keys property identifies the drag keys of the event | - | ||||||||||||||||||||||||
| 346 | \l {drag.source}{source}. | - | ||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||
| 348 | The existence of specific drag types can be determined using the \l hasColor, | - | ||||||||||||||||||||||||
| 349 | \l hasHtml, \l hasText, and \l hasUrls properties. | - | ||||||||||||||||||||||||
| 350 | - | |||||||||||||||||||||||||
| 351 | The list of all supplied formats can be determined using the \l formats property. | - | ||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||
| 353 | Specific drag types can be obtained using the \l colorData, \l html, \l text, | - | ||||||||||||||||||||||||
| 354 | and \l urls properties. | - | ||||||||||||||||||||||||
| 355 | - | |||||||||||||||||||||||||
| 356 | A string version of any available mimeType can be obtained using \l getDataAsString. | - | ||||||||||||||||||||||||
| 357 | */ | - | ||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||
| 359 | /*! | - | ||||||||||||||||||||||||
| 360 | \qmlproperty real QtQuick::DragEvent::x | - | ||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||
| 362 | This property holds the x coordinate of a drag event. | - | ||||||||||||||||||||||||
| 363 | */ | - | ||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||
| 365 | /*! | - | ||||||||||||||||||||||||
| 366 | \qmlproperty real QtQuick::DragEvent::y | - | ||||||||||||||||||||||||
| 367 | - | |||||||||||||||||||||||||
| 368 | This property holds the y coordinate of a drag event. | - | ||||||||||||||||||||||||
| 369 | */ | - | ||||||||||||||||||||||||
| 370 | - | |||||||||||||||||||||||||
| 371 | /*! | - | ||||||||||||||||||||||||
| 372 | \qmlproperty Object QtQuick::DragEvent::drag.source | - | ||||||||||||||||||||||||
| 373 | - | |||||||||||||||||||||||||
| 374 | This property holds the source of a drag event. | - | ||||||||||||||||||||||||
| 375 | */ | - | ||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||
| 377 | /*! | - | ||||||||||||||||||||||||
| 378 | \qmlproperty stringlist QtQuick::DragEvent::keys | - | ||||||||||||||||||||||||
| 379 | - | |||||||||||||||||||||||||
| 380 | This property holds a list of keys identifying the data type or source of a | - | ||||||||||||||||||||||||
| 381 | drag event. | - | ||||||||||||||||||||||||
| 382 | */ | - | ||||||||||||||||||||||||
| 383 | - | |||||||||||||||||||||||||
| 384 | /*! | - | ||||||||||||||||||||||||
| 385 | \qmlproperty enumeration QtQuick::DragEvent::action | - | ||||||||||||||||||||||||
| 386 | - | |||||||||||||||||||||||||
| 387 | This property holds the action that the \l {drag.source}{source} is to perform on an accepted drop. | - | ||||||||||||||||||||||||
| 388 | - | |||||||||||||||||||||||||
| 389 | The drop action may be one of: | - | ||||||||||||||||||||||||
| 390 | - | |||||||||||||||||||||||||
| 391 | \list | - | ||||||||||||||||||||||||
| 392 | \li Qt.CopyAction Copy the data to the target. | - | ||||||||||||||||||||||||
| 393 | \li Qt.MoveAction Move the data from the source to the target. | - | ||||||||||||||||||||||||
| 394 | \li Qt.LinkAction Create a link from the source to the target. | - | ||||||||||||||||||||||||
| 395 | \li Qt.IgnoreAction Ignore the action (do nothing with the data). | - | ||||||||||||||||||||||||
| 396 | \endlist | - | ||||||||||||||||||||||||
| 397 | */ | - | ||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||
| 399 | /*! | - | ||||||||||||||||||||||||
| 400 | \qmlproperty flags QtQuick::DragEvent::supportedActions | - | ||||||||||||||||||||||||
| 401 | - | |||||||||||||||||||||||||
| 402 | This property holds the set of \l {action}{actions} supported by the | - | ||||||||||||||||||||||||
| 403 | drag source. | - | ||||||||||||||||||||||||
| 404 | */ | - | ||||||||||||||||||||||||
| 405 | - | |||||||||||||||||||||||||
| 406 | /*! | - | ||||||||||||||||||||||||
| 407 | \qmlproperty flags QtQuick::DragEvent::proposedAction | - | ||||||||||||||||||||||||
| 408 | \since 5.2 | - | ||||||||||||||||||||||||
| 409 | - | |||||||||||||||||||||||||
| 410 | This property holds the set of \l {action}{actions} proposed by the | - | ||||||||||||||||||||||||
| 411 | drag source. | - | ||||||||||||||||||||||||
| 412 | */ | - | ||||||||||||||||||||||||
| 413 | - | |||||||||||||||||||||||||
| 414 | /*! | - | ||||||||||||||||||||||||
| 415 | \qmlproperty bool QtQuick::DragEvent::accepted | - | ||||||||||||||||||||||||
| 416 | - | |||||||||||||||||||||||||
| 417 | This property holds whether the drag event was accepted by a handler. | - | ||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||
| 419 | The default value is true. | - | ||||||||||||||||||||||||
| 420 | */ | - | ||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | /*! | - | ||||||||||||||||||||||||
| 423 | \qmlmethod QtQuick::DragEvent::accept() | - | ||||||||||||||||||||||||
| 424 | \qmlmethod QtQuick::DragEvent::accept(enumeration action) | - | ||||||||||||||||||||||||
| 425 | - | |||||||||||||||||||||||||
| 426 | Accepts the drag event. | - | ||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||
| 428 | If an \a action is specified it will overwrite the value of the \l action property. | - | ||||||||||||||||||||||||
| 429 | */ | - | ||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||
| 431 | /*! | - | ||||||||||||||||||||||||
| 432 | \qmlmethod QtQuick::DragEvent::acceptProposedAction() | - | ||||||||||||||||||||||||
| 433 | \since 5.2 | - | ||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||
| 435 | Accepts the drag event with the \l proposedAction. | - | ||||||||||||||||||||||||
| 436 | */ | - | ||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||
| 438 | /*! | - | ||||||||||||||||||||||||
| 439 | \qmlproperty bool QtQuick::DragEvent::hasColor | - | ||||||||||||||||||||||||
| 440 | \since 5.2 | - | ||||||||||||||||||||||||
| 441 | - | |||||||||||||||||||||||||
| 442 | This property holds whether the drag event contains a color item. | - | ||||||||||||||||||||||||
| 443 | */ | - | ||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||
| 445 | /*! | - | ||||||||||||||||||||||||
| 446 | \qmlproperty bool QtQuick::DragEvent::hasHtml | - | ||||||||||||||||||||||||
| 447 | \since 5.2 | - | ||||||||||||||||||||||||
| 448 | - | |||||||||||||||||||||||||
| 449 | This property holds whether the drag event contains a html item. | - | ||||||||||||||||||||||||
| 450 | */ | - | ||||||||||||||||||||||||
| 451 | - | |||||||||||||||||||||||||
| 452 | /*! | - | ||||||||||||||||||||||||
| 453 | \qmlproperty bool QtQuick::DragEvent::hasText | - | ||||||||||||||||||||||||
| 454 | \since 5.2 | - | ||||||||||||||||||||||||
| 455 | - | |||||||||||||||||||||||||
| 456 | This property holds whether the drag event contains a text item. | - | ||||||||||||||||||||||||
| 457 | */ | - | ||||||||||||||||||||||||
| 458 | - | |||||||||||||||||||||||||
| 459 | /*! | - | ||||||||||||||||||||||||
| 460 | \qmlproperty bool QtQuick::DragEvent::hasUrls | - | ||||||||||||||||||||||||
| 461 | \since 5.2 | - | ||||||||||||||||||||||||
| 462 | - | |||||||||||||||||||||||||
| 463 | This property holds whether the drag event contains one or more url items. | - | ||||||||||||||||||||||||
| 464 | */ | - | ||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||
| 466 | /*! | - | ||||||||||||||||||||||||
| 467 | \qmlproperty color QtQuick::DragEvent::colorData | - | ||||||||||||||||||||||||
| 468 | \since 5.2 | - | ||||||||||||||||||||||||
| 469 | - | |||||||||||||||||||||||||
| 470 | This property holds color data, if any. | - | ||||||||||||||||||||||||
| 471 | */ | - | ||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||
| 473 | /*! | - | ||||||||||||||||||||||||
| 474 | \qmlproperty string QtQuick::DragEvent::html | - | ||||||||||||||||||||||||
| 475 | \since 5.2 | - | ||||||||||||||||||||||||
| 476 | - | |||||||||||||||||||||||||
| 477 | This property holds html data, if any. | - | ||||||||||||||||||||||||
| 478 | */ | - | ||||||||||||||||||||||||
| 479 | - | |||||||||||||||||||||||||
| 480 | /*! | - | ||||||||||||||||||||||||
| 481 | \qmlproperty string QtQuick::DragEvent::text | - | ||||||||||||||||||||||||
| 482 | \since 5.2 | - | ||||||||||||||||||||||||
| 483 | - | |||||||||||||||||||||||||
| 484 | This property holds text data, if any. | - | ||||||||||||||||||||||||
| 485 | */ | - | ||||||||||||||||||||||||
| 486 | - | |||||||||||||||||||||||||
| 487 | /*! | - | ||||||||||||||||||||||||
| 488 | \qmlproperty urllist QtQuick::DragEvent::urls | - | ||||||||||||||||||||||||
| 489 | \since 5.2 | - | ||||||||||||||||||||||||
| 490 | - | |||||||||||||||||||||||||
| 491 | This property holds a list of urls, if any. | - | ||||||||||||||||||||||||
| 492 | */ | - | ||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||
| 494 | /*! | - | ||||||||||||||||||||||||
| 495 | \qmlproperty stringlist QtQuick::DragEvent::formats | - | ||||||||||||||||||||||||
| 496 | \since 5.2 | - | ||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||
| 498 | This property holds a list of mime type formats contained in the drag data. | - | ||||||||||||||||||||||||
| 499 | */ | - | ||||||||||||||||||||||||
| 500 | - | |||||||||||||||||||||||||
| 501 | /*! | - | ||||||||||||||||||||||||
| 502 | \qmlmethod string QtQuick::DragEvent::getDataAsString(string format) | - | ||||||||||||||||||||||||
| 503 | \since 5.2 | - | ||||||||||||||||||||||||
| 504 | - | |||||||||||||||||||||||||
| 505 | Returns the data for the given \a format converted to a string. \a format should be one contained in the \l formats property. | - | ||||||||||||||||||||||||
| 506 | */ | - | ||||||||||||||||||||||||
| 507 | - | |||||||||||||||||||||||||
| 508 | /*! | - | ||||||||||||||||||||||||
| 509 | \qmlmethod string QtQuick::DragEvent::getDataAsArrayBuffer(string format) | - | ||||||||||||||||||||||||
| 510 | \since 5.5 | - | ||||||||||||||||||||||||
| 511 | - | |||||||||||||||||||||||||
| 512 | Returns the data for the given \a format into an ArrayBuffer, which can | - | ||||||||||||||||||||||||
| 513 | easily be translated into a QByteArray. \a format should be one contained in the \l formats property. | - | ||||||||||||||||||||||||
| 514 | */ | - | ||||||||||||||||||||||||
| 515 | - | |||||||||||||||||||||||||
| 516 | QObject *QQuickDropEvent::source() const | - | ||||||||||||||||||||||||
| 517 | { | - | ||||||||||||||||||||||||
| 518 | if (const QQuickDragMimeData *dragMime = qobject_cast<const QQuickDragMimeData *>(event->mimeData()))
| 0-104 | ||||||||||||||||||||||||
| 519 | return dragMime->source(); executed 104 times by 2 tests: return dragMime->source();Executed by:
| 104 | ||||||||||||||||||||||||
| 520 | else | - | ||||||||||||||||||||||||
| 521 | return event->source(); never executed: return event->source(); | 0 | ||||||||||||||||||||||||
| 522 | } | - | ||||||||||||||||||||||||
| 523 | - | |||||||||||||||||||||||||
| 524 | QStringList QQuickDropEvent::keys() const | - | ||||||||||||||||||||||||
| 525 | { | - | ||||||||||||||||||||||||
| 526 | return d->getKeys(event->mimeData()); executed 26 times by 1 test: return d->getKeys(event->mimeData());Executed by:
| 26 | ||||||||||||||||||||||||
| 527 | } | - | ||||||||||||||||||||||||
| 528 | - | |||||||||||||||||||||||||
| 529 | bool QQuickDropEvent::hasColor() const | - | ||||||||||||||||||||||||
| 530 | { | - | ||||||||||||||||||||||||
| 531 | return event->mimeData()->hasColor(); never executed: return event->mimeData()->hasColor(); | 0 | ||||||||||||||||||||||||
| 532 | } | - | ||||||||||||||||||||||||
| 533 | - | |||||||||||||||||||||||||
| 534 | bool QQuickDropEvent::hasHtml() const | - | ||||||||||||||||||||||||
| 535 | { | - | ||||||||||||||||||||||||
| 536 | return event->mimeData()->hasHtml(); never executed: return event->mimeData()->hasHtml(); | 0 | ||||||||||||||||||||||||
| 537 | } | - | ||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||
| 539 | bool QQuickDropEvent::hasText() const | - | ||||||||||||||||||||||||
| 540 | { | - | ||||||||||||||||||||||||
| 541 | return event->mimeData()->hasText(); never executed: return event->mimeData()->hasText(); | 0 | ||||||||||||||||||||||||
| 542 | } | - | ||||||||||||||||||||||||
| 543 | - | |||||||||||||||||||||||||
| 544 | bool QQuickDropEvent::hasUrls() const | - | ||||||||||||||||||||||||
| 545 | { | - | ||||||||||||||||||||||||
| 546 | return event->mimeData()->hasUrls(); never executed: return event->mimeData()->hasUrls(); | 0 | ||||||||||||||||||||||||
| 547 | } | - | ||||||||||||||||||||||||
| 548 | - | |||||||||||||||||||||||||
| 549 | QVariant QQuickDropEvent::colorData() const | - | ||||||||||||||||||||||||
| 550 | { | - | ||||||||||||||||||||||||
| 551 | return event->mimeData()->colorData(); never executed: return event->mimeData()->colorData(); | 0 | ||||||||||||||||||||||||
| 552 | } | - | ||||||||||||||||||||||||
| 553 | - | |||||||||||||||||||||||||
| 554 | QString QQuickDropEvent::html() const | - | ||||||||||||||||||||||||
| 555 | { | - | ||||||||||||||||||||||||
| 556 | return event->mimeData()->html(); never executed: return event->mimeData()->html(); | 0 | ||||||||||||||||||||||||
| 557 | } | - | ||||||||||||||||||||||||
| 558 | - | |||||||||||||||||||||||||
| 559 | QString QQuickDropEvent::text() const | - | ||||||||||||||||||||||||
| 560 | { | - | ||||||||||||||||||||||||
| 561 | return event->mimeData()->text(); never executed: return event->mimeData()->text(); | 0 | ||||||||||||||||||||||||
| 562 | } | - | ||||||||||||||||||||||||
| 563 | - | |||||||||||||||||||||||||
| 564 | QList<QUrl> QQuickDropEvent::urls() const | - | ||||||||||||||||||||||||
| 565 | { | - | ||||||||||||||||||||||||
| 566 | return event->mimeData()->urls(); never executed: return event->mimeData()->urls(); | 0 | ||||||||||||||||||||||||
| 567 | } | - | ||||||||||||||||||||||||
| 568 | - | |||||||||||||||||||||||||
| 569 | QStringList QQuickDropEvent::formats() const | - | ||||||||||||||||||||||||
| 570 | { | - | ||||||||||||||||||||||||
| 571 | return event->mimeData()->formats(); never executed: return event->mimeData()->formats(); | 0 | ||||||||||||||||||||||||
| 572 | } | - | ||||||||||||||||||||||||
| 573 | - | |||||||||||||||||||||||||
| 574 | void QQuickDropEvent::getDataAsString(QQmlV4Function *args) | - | ||||||||||||||||||||||||
| 575 | { | - | ||||||||||||||||||||||||
| 576 | if (args->length() != 0) {
| 0 | ||||||||||||||||||||||||
| 577 | QV4::ExecutionEngine *v4 = args->v4engine(); | - | ||||||||||||||||||||||||
| 578 | QV4::Scope scope(v4); | - | ||||||||||||||||||||||||
| 579 | QV4::ScopedValue v(scope, (*args)[0]); | - | ||||||||||||||||||||||||
| 580 | QString format = v->toQString(); | - | ||||||||||||||||||||||||
| 581 | QString rv = QString::fromUtf8(event->mimeData()->data(format)); | - | ||||||||||||||||||||||||
| 582 | args->setReturnValue(v4->newString(rv)->asReturnedValue()); | - | ||||||||||||||||||||||||
| 583 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 584 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 585 | - | |||||||||||||||||||||||||
| 586 | void QQuickDropEvent::getDataAsArrayBuffer(QQmlV4Function *args) | - | ||||||||||||||||||||||||
| 587 | { | - | ||||||||||||||||||||||||
| 588 | if (args->length() != 0) {
| 0-2 | ||||||||||||||||||||||||
| 589 | QV4::ExecutionEngine *v4 = args->v4engine(); | - | ||||||||||||||||||||||||
| 590 | QV4::Scope scope(v4); | - | ||||||||||||||||||||||||
| 591 | QV4::ScopedValue v(scope, (*args)[0]); | - | ||||||||||||||||||||||||
| 592 | const QString format = v->toQString(); | - | ||||||||||||||||||||||||
| 593 | args->setReturnValue(v4->newArrayBuffer(event->mimeData()->data(format))->asReturnedValue()); | - | ||||||||||||||||||||||||
| 594 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 595 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 596 | - | |||||||||||||||||||||||||
| 597 | void QQuickDropEvent::acceptProposedAction(QQmlV4Function *) | - | ||||||||||||||||||||||||
| 598 | { | - | ||||||||||||||||||||||||
| 599 | event->acceptProposedAction(); | - | ||||||||||||||||||||||||
| 600 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 601 | - | |||||||||||||||||||||||||
| 602 | void QQuickDropEvent::accept(QQmlV4Function *args) | - | ||||||||||||||||||||||||
| 603 | { | - | ||||||||||||||||||||||||
| 604 | Qt::DropAction action = event->dropAction(); | - | ||||||||||||||||||||||||
| 605 | - | |||||||||||||||||||||||||
| 606 | if (args->length() >= 1) {
| 2-108 | ||||||||||||||||||||||||
| 607 | QV4::Scope scope(args->v4engine()); | - | ||||||||||||||||||||||||
| 608 | QV4::ScopedValue v(scope, (*args)[0]); | - | ||||||||||||||||||||||||
| 609 | if (v->isInt32())
| 0-2 | ||||||||||||||||||||||||
| 610 | action = Qt::DropAction(v->integerValue()); executed 2 times by 1 test: action = Qt::DropAction(v->integerValue());Executed by:
| 2 | ||||||||||||||||||||||||
| 611 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 612 | - | |||||||||||||||||||||||||
| 613 | // get action from arguments. | - | ||||||||||||||||||||||||
| 614 | event->setDropAction(action); | - | ||||||||||||||||||||||||
| 615 | event->accept(); | - | ||||||||||||||||||||||||
| 616 | } executed 110 times by 2 tests: end of blockExecuted by:
| 110 | ||||||||||||||||||||||||
| 617 | - | |||||||||||||||||||||||||
| 618 | - | |||||||||||||||||||||||||
| 619 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
| 620 | - | |||||||||||||||||||||||||
| 621 | #include "moc_qquickdroparea_p.cpp" | - | ||||||||||||||||||||||||
| 622 | - | |||||||||||||||||||||||||
| 623 | #endif // draganddrop | - | ||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |