qdrag.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qdrag.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5QDrag::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}
never executed: end of block
0
17-
18-
19-
20-
21QDrag::~QDrag()-
22{-
23 QDragPrivate * const d = d_func();-
24 delete d->data;-
25}
never executed: end of block
0
26-
27-
28-
29-
30-
31void QDrag::setMimeData(QMimeData *data)-
32{-
33 QDragPrivate * const d = d_func();-
34 if (d->data == data
d->data == dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
35 return;
never executed: return;
0
36 if (d->data != 0
d->data != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
37 delete d->data;
never executed: delete d->data;
0
38 d->data = data;-
39}
never executed: end of block
0
40-
41-
42-
43-
44QMimeData *QDrag::mimeData() const-
45{-
46 const QDragPrivate * const d = d_func();-
47 return
never executed: return d->data;
d->data;
never executed: return d->data;
0
48}-
49-
50-
51-
52-
53-
54-
55void QDrag::setPixmap(const QPixmap &pixmap)-
56{-
57 QDragPrivate * const d = d_func();-
58 d->pixmap = pixmap;-
59}
never executed: end of block
0
60-
61-
62-
63-
64QPixmap QDrag::pixmap() const-
65{-
66 const QDragPrivate * const d = d_func();-
67 return
never executed: return d->pixmap;
d->pixmap;
never executed: return d->pixmap;
0
68}-
69void QDrag::setHotSpot(const QPoint& hotspot)-
70{-
71 QDragPrivate * const d = d_func();-
72 d->hotspot = hotspot;-
73}
never executed: end of block
0
74-
75-
76-
77-
78-
79QPoint QDrag::hotSpot() const-
80{-
81 const QDragPrivate * const d = d_func();-
82 return
never executed: return d->hotspot;
d->hotspot;
never executed: return d->hotspot;
0
83}-
84-
85-
86-
87-
88-
89QObject *QDrag::source() const-
90{-
91 const QDragPrivate * const d = d_func();-
92 return
never executed: return d->source;
d->source;
never executed: return d->source;
0
93}-
94-
95-
96-
97-
98-
99QObject *QDrag::target() const-
100{-
101 const QDragPrivate * const d = d_func();-
102 return
never executed: return d->target;
d->target;
never executed: return d->target;
0
103}-
104Qt::DropAction QDrag::exec(Qt::DropActions supportedActions)-
105{-
106 return
never executed: return exec(supportedActions, Qt::IgnoreAction);
exec(supportedActions, Qt::IgnoreAction);
never executed: return exec(supportedActions, Qt::IgnoreAction);
0
107}-
108Qt::DropAction QDrag::exec(Qt::DropActions supportedActions, Qt::DropAction defaultDropAction)-
109{-
110 QDragPrivate * const d = d_func();-
111 if (!d->data
!d->dataDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
112 QMessageLogger(__FILE__, 266, __PRETTY_FUNCTION__).warning("QDrag: No mimedata set before starting the drag");-
113 return
never executed: return d->executed_action;
d->executed_action;
never executed: return d->executed_action;
0
114 }-
115 Qt::DropAction transformedDefaultDropAction = Qt::IgnoreAction;-
116-
117 if (defaultDropAction == Qt::IgnoreAction
defaultDropAct...::IgnoreActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
118 if (supportedActions & Qt::MoveAction
supportedActio...Qt::MoveActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
119 transformedDefaultDropAction = Qt::MoveAction;-
120 }
never executed: end of block
else if (supportedActions & Qt::CopyAction
supportedActio...Qt::CopyActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
121 transformedDefaultDropAction = Qt::CopyAction;-
122 }
never executed: end of block
else if (supportedActions & Qt::LinkAction
supportedActio...Qt::LinkActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
123 transformedDefaultDropAction = Qt::LinkAction;-
124 }
never executed: end of block
0
125 }
never executed: end of block
else {
0
126 transformedDefaultDropAction = defaultDropAction;-
127 }
never executed: end of block
0
128 d->supported_actions = supportedActions;-
129 d->default_action = transformedDefaultDropAction;-
130 d->executed_action = QDragManager::self()->drag(this);-
131-
132 return
never executed: return d->executed_action;
d->executed_action;
never executed: return d->executed_action;
0
133}-
134Qt::DropAction QDrag::start(Qt::DropActions request)-
135{-
136 QDragPrivate * const d = d_func();-
137 if (!d->data
!d->dataDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
138 QMessageLogger(__FILE__, 308, __PRETTY_FUNCTION__).warning("QDrag: No mimedata set before starting the drag");-
139 return
never executed: return d->executed_action;
d->executed_action;
never executed: return d->executed_action;
0
140 }-
141 d->supported_actions = request | Qt::CopyAction;-
142 d->default_action = Qt::IgnoreAction;-
143 d->executed_action = QDragManager::self()->drag(this);-
144 return
never executed: return d->executed_action;
d->executed_action;
never executed: return d->executed_action;
0
145}-
146void QDrag::setDragCursor(const QPixmap &cursor, Qt::DropAction action)-
147{-
148 QDragPrivate * const d = d_func();-
149 if (action != Qt::CopyAction
action != Qt::CopyActionDescription
TRUEnever evaluated
FALSEnever evaluated
&& action != Qt::MoveAction
action != Qt::MoveActionDescription
TRUEnever evaluated
FALSEnever evaluated
&& action != Qt::LinkAction
action != Qt::LinkActionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
150 return;
never executed: return;
0
151 if (cursor.isNull()
cursor.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
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-
163QPixmap 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()
it != d->custo...ors.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
170 return
never executed: return it.value();
it.value();
never executed: return it.value();
0
171-
172 Qt::CursorShape shape = Qt::ForbiddenCursor;-
173 switch (action) {-
174 case
never executed: case Qt::MoveAction:
Qt::MoveAction:
never executed: case Qt::MoveAction:
0
175 shape = Qt::DragMoveCursor;-
176 break;
never executed: break;
0
177 case
never executed: case Qt::CopyAction:
Qt::CopyAction:
never executed: case Qt::CopyAction:
0
178 shape = Qt::DragCopyCursor;-
179 break;
never executed: break;
0
180 case
never executed: case Qt::LinkAction:
Qt::LinkAction:
never executed: case Qt::LinkAction:
0
181 shape = Qt::DragLinkCursor;-
182 break;
never executed: break;
0
183 default
never executed: default:
:
never executed: default:
0
184 shape = Qt::ForbiddenCursor;-
185 }
never executed: end of block
0
186 return
never executed: return QGuiApplicationPrivate::instance()->getPixmapCursor(shape);
QGuiApplicationPrivate::instance()->getPixmapCursor(shape);
never executed: return QGuiApplicationPrivate::instance()->getPixmapCursor(shape);
0
187}-
188-
189-
190-
191-
192-
193-
194Qt::DropActions QDrag::supportedActions() const-
195{-
196 const QDragPrivate * const d = d_func();-
197 return
never executed: return d->supported_actions;
d->supported_actions;
never executed: return d->supported_actions;
0
198}-
199-
200-
201-
202-
203-
204-
205-
206Qt::DropAction QDrag::defaultAction() const-
207{-
208 const QDragPrivate * const d = d_func();-
209 return
never executed: return d->default_action;
d->default_action;
never executed: return d->default_action;
0
210}-
211void QDrag::cancel()-
212{-
213 if (QPlatformDrag *platformDrag = QGuiApplicationPrivate::platformIntegration()->drag()
QPlatformDrag ...tion()->drag()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
214 platformDrag->cancelDrag();
never executed: platformDrag->cancelDrag();
0
215}
never executed: end of block
0
216-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9