OpenCoverage

qquickdroparea_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickdroparea_p.h
Source codeSwitch to Preprocessed file
LineSourceCount
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#ifndef QQUICKDROPAREA_P_H-
41#define QQUICKDROPAREA_P_H-
42-
43//-
44// W A R N I N G-
45// --------------
46//-
47// This file is not part of the Qt API. It exists purely as an-
48// implementation detail. This header file may change from version to-
49// version without notice, or even be removed.-
50//-
51// We mean it.-
52//-
53-
54#include "qquickitem.h"-
55-
56#include <QtGui/qevent.h>-
57-
58#if QT_CONFIG(draganddrop)-
59-
60QT_BEGIN_NAMESPACE-
61-
62class QQuickDropAreaPrivate;-
63class QQuickDropEvent : public QObject-
64{-
65 Q_OBJECT-
66 Q_PROPERTY(qreal x READ x)-
67 Q_PROPERTY(qreal y READ y)-
68 Q_PROPERTY(QObject *source READ source)-
69 Q_PROPERTY(QStringList keys READ keys)-
70 Q_PROPERTY(Qt::DropActions supportedActions READ supportedActions)-
71 Q_PROPERTY(Qt::DropActions proposedAction READ proposedAction)-
72 Q_PROPERTY(Qt::DropAction action READ action WRITE setAction RESET resetAction)-
73 Q_PROPERTY(bool accepted READ accepted WRITE setAccepted)-
74 Q_PROPERTY(bool hasColor READ hasColor)-
75 Q_PROPERTY(bool hasHtml READ hasHtml)-
76 Q_PROPERTY(bool hasText READ hasText)-
77 Q_PROPERTY(bool hasUrls READ hasUrls)-
78 Q_PROPERTY(QVariant colorData READ colorData)-
79 Q_PROPERTY(QString html READ html)-
80 Q_PROPERTY(QString text READ text)-
81 Q_PROPERTY(QList<QUrl> urls READ urls)-
82 Q_PROPERTY(QStringList formats READ formats)-
83public:-
84 QQuickDropEvent(QQuickDropAreaPrivate *d, QDropEvent *event) : d(d), event(event) {}
executed 274 times by 2 tests: end of block
Executed by:
  • tst_qquickdroparea
  • tst_qquicklistview
274
85-
86 qreal x() const { return event->pos().x(); }
executed 118 times by 2 tests: return event->pos().x();
Executed by:
  • tst_qquickdroparea
  • tst_qquicklistview
118
87 qreal y() const { return event->pos().y(); }
executed 14 times by 1 test: return event->pos().y();
Executed by:
  • tst_qquickdroparea
14
88-
89 QObject *source() const;-
90-
91 Qt::DropActions supportedActions() const { return event->possibleActions(); }
executed 22 times by 1 test: return event->possibleActions();
Executed by:
  • tst_qquickdroparea
22
92 Qt::DropActions proposedAction() const { return event->proposedAction(); }
never executed: return event->proposedAction();
0
93 Qt::DropAction action() const { return event->dropAction(); }
executed 22 times by 1 test: return event->dropAction();
Executed by:
  • tst_qquickdroparea
22
94 void setAction(Qt::DropAction action) { event->setDropAction(action); }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickdroparea
6
95 void resetAction() { event->setDropAction(event->proposedAction()); }
never executed: end of block
0
96-
97 QStringList keys() const;-
98-
99 bool accepted() const { return event->isAccepted(); }
never executed: return event->isAccepted();
0
100 void setAccepted(bool accepted) { event->setAccepted(accepted); }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquickdroparea
14
101-
102 bool hasColor() const;-
103 bool hasHtml() const;-
104 bool hasText() const;-
105 bool hasUrls() const;-
106 QVariant colorData() const;-
107 QString html() const;-
108 QString text() const;-
109 QList<QUrl> urls() const;-
110 QStringList formats() const;-
111-
112 Q_INVOKABLE void getDataAsString(QQmlV4Function *);-
113 Q_INVOKABLE void getDataAsArrayBuffer(QQmlV4Function *);-
114 Q_INVOKABLE void acceptProposedAction(QQmlV4Function *);-
115 Q_INVOKABLE void accept(QQmlV4Function *);-
116-
117private:-
118 QQuickDropAreaPrivate *d;-
119 QDropEvent *event;-
120};-
121-
122class QQuickDropAreaDrag : public QObject-
123{-
124 Q_OBJECT-
125 Q_PROPERTY(qreal x READ x NOTIFY positionChanged)-
126 Q_PROPERTY(qreal y READ y NOTIFY positionChanged)-
127 Q_PROPERTY(QObject *source READ source NOTIFY sourceChanged)-
128public:-
129 QQuickDropAreaDrag(QQuickDropAreaPrivate *d, QObject *parent = 0);-
130 ~QQuickDropAreaDrag();-
131-
132 qreal x() const;-
133 qreal y() const;-
134 QObject *source() const;-
135-
136Q_SIGNALS:-
137 void positionChanged();-
138 void sourceChanged();-
139-
140private:-
141 QQuickDropAreaPrivate *d;-
142-
143 friend class QQuickDropArea;-
144 friend class QQuickDropAreaPrivate;-
145};-
146-
147class QQuickDropAreaPrivate;-
148class Q_AUTOTEST_EXPORT QQuickDropArea : public QQuickItem-
149{-
150 Q_OBJECT-
151 Q_PROPERTY(bool containsDrag READ containsDrag NOTIFY containsDragChanged)-
152 Q_PROPERTY(QStringList keys READ keys WRITE setKeys NOTIFY keysChanged)-
153 Q_PROPERTY(QQuickDropAreaDrag *drag READ drag CONSTANT)-
154-
155public:-
156 QQuickDropArea(QQuickItem *parent=0);-
157 ~QQuickDropArea();-
158-
159 bool containsDrag() const;-
160 void setContainsDrag(bool drag);-
161-
162 QStringList keys() const;-
163 void setKeys(const QStringList &keys);-
164-
165 QQuickDropAreaDrag *drag();-
166-
167Q_SIGNALS:-
168 void containsDragChanged();-
169 void keysChanged();-
170 void sourceChanged();-
171-
172 void entered(QQuickDropEvent *drag);-
173 void exited();-
174 void positionChanged(QQuickDropEvent *drag);-
175 void dropped(QQuickDropEvent *drop);-
176-
177protected:-
178 void dragMoveEvent(QDragMoveEvent *event) override;-
179 void dragEnterEvent(QDragEnterEvent *event) override;-
180 void dragLeaveEvent(QDragLeaveEvent *event) override;-
181 void dropEvent(QDropEvent *event) override;-
182-
183private:-
184 Q_DISABLE_COPY(QQuickDropArea)-
185 Q_DECLARE_PRIVATE(QQuickDropArea)
executed 520 times by 3 tests: return reinterpret_cast<QQuickDropAreaPrivate *>(qGetPtrHelper(d_ptr));
Executed by:
  • tst_examples
  • tst_qquickdroparea
  • tst_qquicklistview
executed 286 times by 2 tests: return reinterpret_cast<const QQuickDropAreaPrivate *>(qGetPtrHelper(d_ptr));
Executed by:
  • tst_examples
  • tst_qquickdroparea
286-520
186};-
187-
188QT_END_NAMESPACE-
189-
190QML_DECLARE_TYPE(QQuickDropEvent)-
191QML_DECLARE_TYPE(QQuickDropArea)-
192-
193#endif // draganddrop-
194-
195#endif // QQUICKDROPAREA_P_H-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0