Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | QDrag::QDrag(QObject *dragSource) | - |
6 | : QObject(*new QDragPrivate, dragSource) | - |
7 | { | - |
8 | QDragPrivate * const d = d_func(); | - |
9 | d->source = dragSource; | - |
10 | d->target = 0; | - |
11 | d->data = 0; | - |
12 | d->hotspot = QPoint(-10, -10); | - |
13 | d->executed_action = Qt::IgnoreAction; | - |
14 | d->supported_actions = Qt::IgnoreAction; | - |
15 | d->default_action = Qt::IgnoreAction; | - |
16 | } executed: } Execution Count:1 | 1 |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | QDrag::~QDrag() | - |
22 | { | - |
23 | QDragPrivate * const d = d_func(); | - |
24 | delete d->data; | - |
25 | } executed: } Execution Count:1 | 1 |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | void QDrag::setMimeData(QMimeData *data) | - |
32 | { | - |
33 | QDragPrivate * const d = d_func(); | - |
34 | if (d->data == data) evaluated: d->data == data yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
35 | return; executed: return; Execution Count:1 | 1 |
36 | if (d->data != 0) evaluated: d->data != 0 yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
37 | delete d->data; executed: delete d->data; Execution Count:1 | 1 |
38 | d->data = data; | - |
39 | } executed: } Execution Count:2 | 2 |
40 | | - |
41 | | - |
42 | | - |
43 | | - |
44 | QMimeData *QDrag::mimeData() const | - |
45 | { | - |
46 | const QDragPrivate * const d = d_func(); | - |
47 | return d->data; executed: return d->data; Execution Count:3 | 3 |
48 | } | - |
49 | | - |
50 | | - |
51 | | - |
52 | | - |
53 | | - |
54 | | - |
55 | void QDrag::setPixmap(const QPixmap &pixmap) | - |
56 | { | - |
57 | QDragPrivate * const d = d_func(); | - |
58 | d->pixmap = pixmap; | - |
59 | } | 0 |
60 | | - |
61 | | - |
62 | | - |
63 | | - |
64 | QPixmap QDrag::pixmap() const | - |
65 | { | - |
66 | const QDragPrivate * const d = d_func(); | - |
67 | return d->pixmap; never executed: return d->pixmap; | 0 |
68 | } | - |
69 | void QDrag::setHotSpot(const QPoint& hotspot) | - |
70 | { | - |
71 | QDragPrivate * const d = d_func(); | - |
72 | d->hotspot = hotspot; | - |
73 | } | 0 |
74 | | - |
75 | | - |
76 | | - |
77 | | - |
78 | | - |
79 | QPoint QDrag::hotSpot() const | - |
80 | { | - |
81 | const QDragPrivate * const d = d_func(); | - |
82 | return d->hotspot; never executed: return d->hotspot; | 0 |
83 | } | - |
84 | | - |
85 | | - |
86 | | - |
87 | | - |
88 | | - |
89 | QObject *QDrag::source() const | - |
90 | { | - |
91 | const QDragPrivate * const d = d_func(); | - |
92 | return d->source; never executed: return d->source; | 0 |
93 | } | - |
94 | | - |
95 | | - |
96 | | - |
97 | | - |
98 | | - |
99 | QObject *QDrag::target() const | - |
100 | { | - |
101 | const QDragPrivate * const d = d_func(); | - |
102 | return d->target; never executed: return d->target; | 0 |
103 | } | - |
104 | Qt::DropAction QDrag::exec(Qt::DropActions supportedActions) | - |
105 | { | - |
106 | return exec(supportedActions, Qt::IgnoreAction); never executed: return exec(supportedActions, Qt::IgnoreAction); | 0 |
107 | } | - |
108 | Qt::DropAction QDrag::exec(Qt::DropActions supportedActions, Qt::DropAction defaultDropAction) | - |
109 | { | - |
110 | QDragPrivate * const d = d_func(); | - |
111 | if (!d->data) { never evaluated: !d->data | 0 |
112 | QMessageLogger("kernel/qdrag.cpp", 264, __PRETTY_FUNCTION__).warning("QDrag: No mimedata set before starting the drag"); | - |
113 | return d->executed_action; never executed: return d->executed_action; | 0 |
114 | } | - |
115 | Qt::DropAction transformedDefaultDropAction = Qt::IgnoreAction; | - |
116 | | - |
117 | if (defaultDropAction == Qt::IgnoreAction) { never evaluated: defaultDropAction == Qt::IgnoreAction | 0 |
118 | if (supportedActions & Qt::MoveAction) { never evaluated: supportedActions & Qt::MoveAction | 0 |
119 | transformedDefaultDropAction = Qt::MoveAction; | - |
120 | } else if (supportedActions & Qt::CopyAction) { never evaluated: supportedActions & Qt::CopyAction | 0 |
121 | transformedDefaultDropAction = Qt::CopyAction; | - |
122 | } else if (supportedActions & Qt::LinkAction) { never evaluated: supportedActions & Qt::LinkAction | 0 |
123 | transformedDefaultDropAction = Qt::LinkAction; | - |
124 | } | 0 |
125 | } else { | - |
126 | transformedDefaultDropAction = defaultDropAction; | - |
127 | } | 0 |
128 | d->supported_actions = supportedActions; | - |
129 | d->default_action = transformedDefaultDropAction; | - |
130 | d->executed_action = QDragManager::self()->drag(this); | - |
131 | | - |
132 | return d->executed_action; never executed: return d->executed_action; | 0 |
133 | } | - |
134 | Qt::DropAction QDrag::start(Qt::DropActions request) | - |
135 | { | - |
136 | QDragPrivate * const d = d_func(); | - |
137 | if (!d->data) { partially evaluated: !d->data yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
138 | QMessageLogger("kernel/qdrag.cpp", 306, __PRETTY_FUNCTION__).warning("QDrag: No mimedata set before starting the drag"); | - |
139 | return d->executed_action; executed: return d->executed_action; Execution Count:2 | 2 |
140 | } | - |
141 | d->supported_actions = request | Qt::CopyAction; | - |
142 | d->default_action = Qt::IgnoreAction; | - |
143 | d->executed_action = QDragManager::self()->drag(this); | - |
144 | return d->executed_action; never executed: return d->executed_action; | 0 |
145 | } | - |
146 | void QDrag::setDragCursor(const QPixmap &cursor, Qt::DropAction action) | - |
147 | { | - |
148 | QDragPrivate * const d = d_func(); | - |
149 | if (action != Qt::CopyAction && action != Qt::MoveAction && action != Qt::LinkAction) never evaluated: action != Qt::CopyAction never evaluated: action != Qt::MoveAction never evaluated: action != Qt::LinkAction | 0 |
150 | return; | 0 |
151 | if (cursor.isNull()) never evaluated: cursor.isNull() | 0 |
152 | d->customCursors.remove(action); never executed: d->customCursors.remove(action); | 0 |
153 | else | - |
154 | d->customCursors[action] = cursor; never executed: d->customCursors[action] = cursor; | 0 |
155 | } | - |
156 | | - |
157 | | - |
158 | | - |
159 | | - |
160 | | - |
161 | | - |
162 | | - |
163 | QPixmap QDrag::dragCursor(Qt::DropAction action) const | - |
164 | { | - |
165 | typedef QMap<Qt::DropAction, QPixmap>::const_iterator Iterator; | - |
166 | | - |
167 | const QDragPrivate * const d = d_func(); | - |
168 | const Iterator it = d->customCursors.constFind(action); | - |
169 | if (it != d->customCursors.constEnd()) never evaluated: it != d->customCursors.constEnd() | 0 |
170 | return it.value(); never executed: return it.value(); | 0 |
171 | | - |
172 | Qt::CursorShape shape = Qt::ForbiddenCursor; | - |
173 | switch (action) { | - |
174 | case Qt::MoveAction: | - |
175 | shape = Qt::DragMoveCursor; | - |
176 | break; | 0 |
177 | case Qt::CopyAction: | - |
178 | shape = Qt::DragCopyCursor; | - |
179 | break; | 0 |
180 | case Qt::LinkAction: | - |
181 | shape = Qt::DragLinkCursor; | - |
182 | break; | 0 |
183 | default: | - |
184 | shape = Qt::ForbiddenCursor; | - |
185 | } | 0 |
186 | return QGuiApplicationPrivate::instance()->getPixmapCursor(shape); never executed: return QGuiApplicationPrivate::instance()->getPixmapCursor(shape); | 0 |
187 | } | - |
188 | | - |
189 | | - |
190 | | - |
191 | | - |
192 | | - |
193 | | - |
194 | Qt::DropActions QDrag::supportedActions() const | - |
195 | { | - |
196 | const QDragPrivate * const d = d_func(); | - |
197 | return d->supported_actions; never executed: return d->supported_actions; | 0 |
198 | } | - |
199 | | - |
200 | | - |
201 | | - |
202 | | - |
203 | | - |
204 | | - |
205 | | - |
206 | Qt::DropAction QDrag::defaultAction() const | - |
207 | { | - |
208 | const QDragPrivate * const d = d_func(); | - |
209 | return d->default_action; never executed: return d->default_action; | 0 |
210 | } | - |
211 | | - |
212 | | - |
| | |