graphicsview/qgraphicsproxywidget.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); -
8__attribute__((visibility("default"))) extern bool qt_tab_all_widgets(); -
9 -
10 -
11 -
12 -
13void QGraphicsProxyWidgetPrivate::init() -
14{ -
15 QGraphicsProxyWidget * const q = q_func(); -
16 q->setFocusPolicy(Qt::WheelFocus); -
17 q->setAcceptDrops(true); -
18}
executed: }
Execution Count:8
8
19 -
20 -
21 -
22 -
23void QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(QGraphicsSceneHoverEvent *event) -
24{ -
25 QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove); -
26 mouseEvent.setPos(event->pos()); -
27 mouseEvent.setScreenPos(event->screenPos()); -
28 mouseEvent.setButton(Qt::NoButton); -
29 mouseEvent.setButtons(0); -
30 mouseEvent.setModifiers(event->modifiers()); -
31 sendWidgetMouseEvent(&mouseEvent); -
32 event->setAccepted(mouseEvent.isAccepted()); -
33}
never executed: }
0
34 -
35 -
36 -
37 -
38void QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(QGraphicsSceneMouseEvent *event) -
39{ -
40 if (!event || !widget || !widget->isVisible())
never evaluated: !event
never evaluated: !widget
never evaluated: !widget->isVisible()
0
41 return;
never executed: return;
0
42 QGraphicsProxyWidget * const q = q_func(); -
43 -
44 -
45 QPointF pos = event->pos(); -
46 QPointer<QWidget> alienWidget = widget->childAt(pos.toPoint()); -
47 QPointer<QWidget> receiver = alienWidget ? alienWidget : widget;
never evaluated: alienWidget
0
48 -
49 if (QWidgetPrivate::nearestGraphicsProxyWidget(receiver) != q)
never evaluated: QWidgetPrivate::nearestGraphicsProxyWidget(receiver) != q
0
50 return;
never executed: return;
0
51 -
52 -
53 QEvent::Type type = QEvent::None; -
54 switch (event->type()) { -
55 case QEvent::GraphicsSceneMousePress: -
56 type = QEvent::MouseButtonPress; -
57 if (!embeddedMouseGrabber)
never evaluated: !embeddedMouseGrabber
0
58 embeddedMouseGrabber = receiver;
never executed: embeddedMouseGrabber = receiver;
0
59 else -
60 receiver = embeddedMouseGrabber;
never executed: receiver = embeddedMouseGrabber;
0
61 break;
never executed: break;
0
62 case QEvent::GraphicsSceneMouseRelease: -
63 type = QEvent::MouseButtonRelease; -
64 if (embeddedMouseGrabber)
never evaluated: embeddedMouseGrabber
0
65 receiver = embeddedMouseGrabber;
never executed: receiver = embeddedMouseGrabber;
0
66 break;
never executed: break;
0
67 case QEvent::GraphicsSceneMouseDoubleClick: -
68 type = QEvent::MouseButtonDblClick; -
69 if (!embeddedMouseGrabber)
never evaluated: !embeddedMouseGrabber
0
70 embeddedMouseGrabber = receiver;
never executed: embeddedMouseGrabber = receiver;
0
71 else -
72 receiver = embeddedMouseGrabber;
never executed: receiver = embeddedMouseGrabber;
0
73 break;
never executed: break;
0
74 case QEvent::GraphicsSceneMouseMove: -
75 type = QEvent::MouseMove; -
76 if (embeddedMouseGrabber)
never evaluated: embeddedMouseGrabber
0
77 receiver = embeddedMouseGrabber;
never executed: receiver = embeddedMouseGrabber;
0
78 break;
never executed: break;
0
79 default: -
80 qt_noop(); -
81 break;
never executed: break;
0
82 } -
83 -
84 if (!lastWidgetUnderMouse) {
never evaluated: !lastWidgetUnderMouse
0
85 QApplicationPrivate::dispatchEnterLeave(embeddedMouseGrabber ? embeddedMouseGrabber : receiver, 0, event->screenPos()); -
86 lastWidgetUnderMouse = receiver; -
87 }
never executed: }
0
88 -
89 -
90 pos = mapToReceiver(pos, receiver); -
91 -
92 -
93 QMouseEvent mouseEvent(type, pos, receiver->mapTo(receiver->topLevelWidget(), pos.toPoint()), -
94 receiver->mapToGlobal(pos.toPoint()), -
95 event->button(), event->buttons(), event->modifiers()); -
96 -
97 QWidget *embeddedMouseGrabberPtr = (QWidget *)embeddedMouseGrabber; -
98 QApplicationPrivate::sendMouseEvent(receiver, &mouseEvent, alienWidget, widget, -
99 &embeddedMouseGrabberPtr, lastWidgetUnderMouse, event->spontaneous()); -
100 embeddedMouseGrabber = embeddedMouseGrabberPtr; -
101 -
102 -
103 -
104 if (embeddedMouseGrabber && type == QEvent::MouseButtonRelease && !event->buttons()) {
never evaluated: embeddedMouseGrabber
never evaluated: type == QEvent::MouseButtonRelease
never evaluated: !event->buttons()
0
105 QGraphicsProxyWidget * const q = q_func(); -
106 if (q->rect().contains(event->pos()) && q->acceptHoverEvents())
never evaluated: q->rect().contains(event->pos())
never evaluated: q->acceptHoverEvents()
0
107 lastWidgetUnderMouse = alienWidget ? alienWidget : widget;
never executed: lastWidgetUnderMouse = alienWidget ? alienWidget : widget;
never evaluated: alienWidget
0
108 else -
109 lastWidgetUnderMouse = 0;
never executed: lastWidgetUnderMouse = 0;
0
110 -
111 QApplicationPrivate::dispatchEnterLeave(lastWidgetUnderMouse, embeddedMouseGrabber, event->screenPos()); -
112 embeddedMouseGrabber = 0; -
113 -
114 -
115 -
116 if (!lastWidgetUnderMouse)
never evaluated: !lastWidgetUnderMouse
0
117 q->unsetCursor();
never executed: q->unsetCursor();
0
118 -
119 }
never executed: }
0
120 -
121 event->setAccepted(mouseEvent.isAccepted()); -
122}
never executed: }
0
123 -
124void QGraphicsProxyWidgetPrivate::sendWidgetKeyEvent(QKeyEvent *event) -
125{ -
126 QGraphicsProxyWidget * const q = q_func(); -
127 if (!event || !widget || !widget->isVisible())
never evaluated: !event
never evaluated: !widget
never evaluated: !widget->isVisible()
0
128 return;
never executed: return;
0
129 -
130 QPointer<QWidget> receiver = widget->focusWidget(); -
131 if (!receiver)
never evaluated: !receiver
0
132 receiver = widget;
never executed: receiver = widget;
0
133 qt_noop(); -
134 -
135 do { -
136 bool res = QApplication::sendEvent(receiver, event); -
137 if ((res && event->isAccepted()) || (q->isWindow() && receiver == widget))
never evaluated: res
never evaluated: event->isAccepted()
never evaluated: q->isWindow()
never evaluated: receiver == widget
0
138 break;
never executed: break;
0
139 receiver = receiver->parentWidget(); -
140 } while (receiver);
never executed: }
never evaluated: receiver
0
141}
never executed: }
0
142 -
143 -
144 -
145 -
146void QGraphicsProxyWidgetPrivate::removeSubFocusHelper(QWidget *widget, Qt::FocusReason reason) -
147{ -
148 QFocusEvent event(QEvent::FocusOut, reason); -
149 QPointer<QWidget> widgetGuard = widget; -
150 QApplication::sendEvent(widget, &event); -
151 if (widgetGuard && event.isAccepted())
never evaluated: widgetGuard
never evaluated: event.isAccepted()
0
152 QApplication::sendEvent(widget->style(), &event);
never executed: QApplication::sendEvent(widget->style(), &event);
0
153}
never executed: }
0
154 -
155 -
156 -
157 -
158 -
159QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next) const -
160{ -
161 if (!widget)
never evaluated: !widget
0
162 return 0;
never executed: return 0;
0
163 -
164 -
165 if (!child) {
never evaluated: !child
0
166 child = next ? (QWidget *)widget : widget->d_func()->focus_prev;
never evaluated: next
0
167 } else {
never executed: }
0
168 child = next ? child->d_func()->focus_next : child->d_func()->focus_prev;
never evaluated: next
0
169 if ((next && child == widget) || (!next && child == widget->d_func()->focus_prev)) {
never evaluated: next
never evaluated: child == widget
never evaluated: !next
never evaluated: child == widget->d_func()->focus_prev
0
170 return 0;
never executed: return 0;
0
171 } -
172 }
never executed: }
0
173 -
174 QWidget *oldChild = child; -
175 uint focus_flag = qt_tab_all_widgets() ? Qt::TabFocus : Qt::StrongFocus;
never evaluated: qt_tab_all_widgets()
0
176 do { -
177 if (child->isEnabled()
never evaluated: child->isEnabled()
0
178 && child->isVisibleTo(widget)
never evaluated: child->isVisibleTo(widget)
0
179 && ((child->focusPolicy() & focus_flag) == focus_flag)
never evaluated: ((child->focusPolicy() & focus_flag) == focus_flag)
0
180 && !(child->d_func()->extra && child->d_func()->extra->focus_proxy)) {
never evaluated: child->d_func()->extra
never evaluated: child->d_func()->extra->focus_proxy
0
181 return child;
never executed: return child;
0
182 } -
183 child = next ? child->d_func()->focus_next : child->d_func()->focus_prev;
never evaluated: next
0
184 } while (child != oldChild && !(next && child == widget) && !(!next && child == widget->d_func()->focus_prev));
never executed: }
never evaluated: child != oldChild
never evaluated: next
never evaluated: child == widget
never evaluated: !next
never evaluated: child == widget->d_func()->focus_prev
0
185 return 0;
never executed: return 0;
0
186} -
187 -
188 -
189 -
190 -
191void QGraphicsProxyWidgetPrivate::_q_removeWidgetSlot() -
192{ -
193 QGraphicsProxyWidget * const q = q_func(); -
194 widget = 0; -
195 delete q; -
196}
never executed: }
0
197 -
198 -
199 -
200 -
201void QGraphicsProxyWidgetPrivate::updateWidgetGeometryFromProxy() -
202{ -
203} -
204 -
205 -
206 -
207 -
208void QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget() -
209{ -
210 QGraphicsProxyWidget * const q = q_func(); -
211 if (!widget)
partially evaluated: !widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
212 return;
never executed: return;
0
213 -
214 QRectF widgetGeometry = widget->geometry(); -
215 QWidget *parentWidget = widget->parentWidget(); -
216 if (widget->isWindow()) {
partially evaluated: widget->isWindow()
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
217 QGraphicsProxyWidget *proxyParent = 0; -
218 if (parentWidget && (proxyParent = qobject_cast<QGraphicsProxyWidget *>(q->parentWidget()))) {
partially evaluated: parentWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
never evaluated: (proxyParent = qobject_cast<QGraphicsProxyWidget *>(q->parentWidget()))
0-8
219 -
220 -
221 -
222 widgetGeometry.moveTo(proxyParent->subWidgetRect(parentWidget).topLeft() -
223 + parentWidget->mapFromGlobal(widget->pos())); -
224 }
never executed: }
0
225 }
executed: }
Execution Count:8
8
226 -
227 -
228 if (!widget->size().isValid())
partially evaluated: !widget->size().isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
229 widgetGeometry.setSize(widget->sizeHint());
never executed: widgetGeometry.setSize(widget->sizeHint());
0
230 -
231 -
232 posChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode; -
233 sizeChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode; -
234 q->setGeometry(widgetGeometry); -
235 posChangeMode = QGraphicsProxyWidgetPrivate::NoMode; -
236 sizeChangeMode = QGraphicsProxyWidgetPrivate::NoMode; -
237}
executed: }
Execution Count:8
8
238 -
239 -
240 -
241 -
242void QGraphicsProxyWidgetPrivate::updateProxyInputMethodAcceptanceFromWidget() -
243{ -
244 QGraphicsProxyWidget * const q = q_func(); -
245 if (!widget)
partially evaluated: !widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
246 return;
never executed: return;
0
247 -
248 QWidget *focusWidget = widget->focusWidget(); -
249 if (!focusWidget)
partially evaluated: !focusWidget
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
250 focusWidget = widget;
executed: focusWidget = widget;
Execution Count:8
8
251 q->setFlag(QGraphicsItem::ItemAcceptsInputMethod, -
252 focusWidget->testAttribute(Qt::WA_InputMethodEnabled)); -
253}
executed: }
Execution Count:8
8
254void QGraphicsProxyWidgetPrivate::embedSubWindow(QWidget *subWin) -
255{ -
256 QWExtra *extra; -
257 if (!((extra = subWin->d_func()->extra) && extra->proxyWidget)) {
never evaluated: (extra = subWin->d_func()->extra)
never evaluated: extra->proxyWidget
0
258 QGraphicsProxyWidget *subProxy = new QGraphicsProxyWidget(q_func(), subWin->windowFlags()); -
259 subProxy->d_func()->setWidget_helper(subWin, false); -
260 }
never executed: }
0
261}
never executed: }
0
262void QGraphicsProxyWidgetPrivate::unembedSubWindow(QWidget *subWin) -
263{ -
264 for (QForeachContainer<__typeof__(children)> _container_(children); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *child = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
265 if (child->isWidget()) {
never evaluated: child->isWidget()
0
266 if (QGraphicsProxyWidget *proxy = qobject_cast<QGraphicsProxyWidget *>(static_cast<QGraphicsWidget *>(child))) {
never evaluated: QGraphicsProxyWidget *proxy = qobject_cast<QGraphicsProxyWidget *>(static_cast<QGraphicsWidget *>(child))
0
267 if (proxy->widget() == subWin) {
never evaluated: proxy->widget() == subWin
0
268 proxy->setWidget(0); -
269 scene->removeItem(proxy); -
270 delete proxy; -
271 return;
never executed: return;
0
272 } -
273 }
never executed: }
0
274 }
never executed: }
0
275 }
never executed: }
0
276}
never executed: }
0
277 -
278bool QGraphicsProxyWidgetPrivate::isProxyWidget() const -
279{ -
280 return true;
never executed: return true;
0
281} -
282 -
283 -
284 -
285 -
286QPointF QGraphicsProxyWidgetPrivate::mapToReceiver(const QPointF &pos, const QWidget *receiver) const -
287{ -
288 QPointF p = pos; -
289 -
290 -
291 while (receiver && receiver != widget) {
never evaluated: receiver
never evaluated: receiver != widget
0
292 p -= QPointF(receiver->pos()); -
293 receiver = receiver->parentWidget(); -
294 }
never executed: }
0
295 return p;
never executed: return p;
0
296} -
297 -
298 -
299 -
300 -
301 -
302QGraphicsProxyWidget::QGraphicsProxyWidget(QGraphicsItem *parent, Qt::WindowFlags wFlags) -
303 : QGraphicsWidget(*new QGraphicsProxyWidgetPrivate, parent, wFlags) -
304{ -
305 QGraphicsProxyWidgetPrivate * const d = d_func(); -
306 d->init(); -
307}
executed: }
Execution Count:8
8
308 -
309 -
310 -
311 -
312QGraphicsProxyWidget::~QGraphicsProxyWidget() -
313{ -
314 QGraphicsProxyWidgetPrivate * const d = d_func(); -
315 if (d->widget) {
partially evaluated: d->widget
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
316 QObject::disconnect(d->widget, "2""destroyed()", this, "1""_q_removeWidgetSlot()"); -
317 delete d->widget; -
318 }
executed: }
Execution Count:4
4
319}
executed: }
Execution Count:4
4
320void QGraphicsProxyWidget::setWidget(QWidget *widget) -
321{ -
322 QGraphicsProxyWidgetPrivate * const d = d_func(); -
323 d->setWidget_helper(widget, true); -
324}
executed: }
Execution Count:8
8
325 -
326void QGraphicsProxyWidgetPrivate::setWidget_helper(QWidget *newWidget, bool autoShow) -
327{ -
328 QGraphicsProxyWidget * const q = q_func(); -
329 if (newWidget == widget)
partially evaluated: newWidget == widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
330 return;
never executed: return;
0
331 if (widget) {
partially evaluated: widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
332 QObject::disconnect(widget, "2""destroyed()", q, "1""_q_removeWidgetSlot()"); -
333 widget->removeEventFilter(q); -
334 widget->setAttribute(Qt::WA_DontShowOnScreen, false); -
335 widget->d_func()->extra->proxyWidget = 0; -
336 resolveFont(inheritedFontResolveMask); -
337 resolvePalette(inheritedPaletteResolveMask); -
338 widget->update(); -
339 -
340 for (QForeachContainer<__typeof__(q->childItems())> _container_(q->childItems()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *child = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
341 if (child->d_ptr->isProxyWidget()) {
never evaluated: child->d_ptr->isProxyWidget()
0
342 QGraphicsProxyWidget *childProxy = static_cast<QGraphicsProxyWidget *>(child); -
343 QWidget * parent = childProxy->widget(); -
344 while (parent->parentWidget() != 0) {
never evaluated: parent->parentWidget() != 0
0
345 if (parent == widget)
never evaluated: parent == widget
0
346 break;
never executed: break;
0
347 parent = parent->parentWidget(); -
348 }
never executed: }
0
349 if (!childProxy->widget() || parent != widget)
never evaluated: !childProxy->widget()
never evaluated: parent != widget
0
350 continue;
never executed: continue;
0
351 childProxy->setWidget(0); -
352 delete childProxy; -
353 }
never executed: }
0
354 }
never executed: }
0
355 -
356 widget = 0; -
357 -
358 q->unsetCursor(); -
359 -
360 q->setAcceptHoverEvents(false); -
361 if (!newWidget)
never evaluated: !newWidget
0
362 q->update();
never executed: q->update();
0
363 }
never executed: }
0
364 if (!newWidget)
partially evaluated: !newWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
365 return;
never executed: return;
0
366 if (!newWidget->isWindow()) {
partially evaluated: !newWidget->isWindow()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
367 QWExtra *extra = newWidget->parentWidget()->d_func()->extra; -
368 if (!extra || !extra->proxyWidget) {
never evaluated: !extra
never evaluated: !extra->proxyWidget
0
369 QMessageLogger("graphicsview/qgraphicsproxywidget.cpp", 603, __PRETTY_FUNCTION__).warning("QGraphicsProxyWidget::setWidget: cannot embed widget %p " -
370 "which is not a toplevel widget, and is not a child of an embedded widget", newWidget); -
371 return;
never executed: return;
0
372 } -
373 }
never executed: }
0
374 -
375 -
376 -
377 QWExtra *extra = newWidget->d_func()->extra; -
378 if (!extra) {
evaluated: !extra
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1
1-7
379 newWidget->d_func()->createExtra(); -
380 extra = newWidget->d_func()->extra; -
381 }
executed: }
Execution Count:7
7
382 QGraphicsProxyWidget **proxyWidget = &extra->proxyWidget; -
383 if (*proxyWidget) {
partially evaluated: *proxyWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
384 if (*proxyWidget != q) {
never evaluated: *proxyWidget != q
0
385 QMessageLogger("graphicsview/qgraphicsproxywidget.cpp", 619, __PRETTY_FUNCTION__).warning("QGraphicsProxyWidget::setWidget: cannot embed widget %p" -
386 "; already embedded", newWidget); -
387 }
never executed: }
0
388 return;
never executed: return;
0
389 } -
390 *proxyWidget = q; -
391 -
392 newWidget->setAttribute(Qt::WA_DontShowOnScreen); -
393 newWidget->ensurePolished(); -
394 -
395 -
396 newWidget->setAttribute(Qt::WA_QuitOnClose, false); -
397 q->setAcceptHoverEvents(true); -
398 -
399 if (newWidget->testAttribute(Qt::WA_NoSystemBackground))
partially evaluated: newWidget->testAttribute(Qt::WA_NoSystemBackground)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
400 q->setAttribute(Qt::WA_NoSystemBackground);
never executed: q->setAttribute(Qt::WA_NoSystemBackground);
0
401 if (newWidget->testAttribute(Qt::WA_OpaquePaintEvent))
partially evaluated: newWidget->testAttribute(Qt::WA_OpaquePaintEvent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
402 q->setAttribute(Qt::WA_OpaquePaintEvent);
never executed: q->setAttribute(Qt::WA_OpaquePaintEvent);
0
403 -
404 widget = newWidget; -
405 -
406 -
407 enabledChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode; -
408 visibleChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode; -
409 posChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode; -
410 sizeChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode; -
411 -
412 if ((autoShow && !newWidget->testAttribute(Qt::WA_WState_ExplicitShowHide)) || !newWidget->testAttribute(Qt::WA_WState_Hidden)) {
partially evaluated: autoShow
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: !newWidget->testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
never evaluated: !newWidget->testAttribute(Qt::WA_WState_Hidden)
0-8
413 newWidget->show(); -
414 }
executed: }
Execution Count:8
8
415 -
416 -
417 -
418 if (newWidget->testAttribute(Qt::WA_SetCursor))
evaluated: newWidget->testAttribute(Qt::WA_SetCursor)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:7
1-7
419 q->setCursor(widget->cursor());
executed: q->setCursor(widget->cursor());
Execution Count:1
1
420 -
421 q->setEnabled(newWidget->isEnabled()); -
422 q->setVisible(newWidget->isVisible()); -
423 q->setLayoutDirection(newWidget->layoutDirection()); -
424 if (newWidget->testAttribute(Qt::WA_SetStyle))
partially evaluated: newWidget->testAttribute(Qt::WA_SetStyle)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
425 q->setStyle(widget->style());
never executed: q->setStyle(widget->style());
0
426 -
427 resolveFont(inheritedFontResolveMask); -
428 resolvePalette(inheritedPaletteResolveMask); -
429 -
430 if (!newWidget->testAttribute(Qt::WA_Resized))
partially evaluated: !newWidget->testAttribute(Qt::WA_Resized)
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
431 newWidget->adjustSize();
executed: newWidget->adjustSize();
Execution Count:8
8
432 -
433 int left, top, right, bottom; -
434 newWidget->getContentsMargins(&left, &top, &right, &bottom); -
435 q->setContentsMargins(left, top, right, bottom); -
436 q->setWindowTitle(newWidget->windowTitle()); -
437 -
438 -
439 q->setSizePolicy(newWidget->sizePolicy()); -
440 QSize sz = newWidget->minimumSize(); -
441 q->setMinimumSize(sz.isNull() ? QSizeF() : QSizeF(sz)); -
442 sz = newWidget->maximumSize(); -
443 q->setMaximumSize(sz.isNull() ? QSizeF() : QSizeF(sz)); -
444 -
445 updateProxyGeometryFromWidget(); -
446 -
447 updateProxyInputMethodAcceptanceFromWidget(); -
448 -
449 -
450 newWidget->installEventFilter(q); -
451 QObject::connect(newWidget, "2""destroyed()", q, "1""_q_removeWidgetSlot()"); -
452 -
453 -
454 enabledChangeMode = QGraphicsProxyWidgetPrivate::NoMode; -
455 visibleChangeMode = QGraphicsProxyWidgetPrivate::NoMode; -
456 posChangeMode = QGraphicsProxyWidgetPrivate::NoMode; -
457 sizeChangeMode = QGraphicsProxyWidgetPrivate::NoMode; -
458}
executed: }
Execution Count:8
8
459 -
460 -
461 -
462 -
463 -
464 -
465QWidget *QGraphicsProxyWidget::widget() const -
466{ -
467 const QGraphicsProxyWidgetPrivate * const d = d_func(); -
468 return d->widget;
executed: return d->widget;
Execution Count:16
16
469} -
470QRectF QGraphicsProxyWidget::subWidgetRect(const QWidget *widget) const -
471{ -
472 const QGraphicsProxyWidgetPrivate * const d = d_func(); -
473 if (!widget || !d->widget)
never evaluated: !widget
never evaluated: !d->widget
0
474 return QRectF();
never executed: return QRectF();
0
475 if (d->widget == widget || d->widget->isAncestorOf(widget))
never evaluated: d->widget == widget
never evaluated: d->widget->isAncestorOf(widget)
0
476 return QRectF(widget->mapTo(d->widget, QPoint(0, 0)), widget->size());
never executed: return QRectF(widget->mapTo(d->widget, QPoint(0, 0)), widget->size());
0
477 return QRectF();
never executed: return QRectF();
0
478} -
479 -
480 -
481 -
482 -
483void QGraphicsProxyWidget::setGeometry(const QRectF &rect) -
484{ -
485 QGraphicsProxyWidgetPrivate * const d = d_func(); -
486 bool proxyResizesWidget = !d->posChangeMode && !d->sizeChangeMode;
evaluated: !d->posChangeMode
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:22
partially evaluated: !d->sizeChangeMode
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-22
487 if (proxyResizesWidget) {
evaluated: proxyResizesWidget
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:22
4-22
488 d->posChangeMode = QGraphicsProxyWidgetPrivate::ProxyToWidgetMode; -
489 d->sizeChangeMode = QGraphicsProxyWidgetPrivate::ProxyToWidgetMode; -
490 }
executed: }
Execution Count:4
4
491 QGraphicsWidget::setGeometry(rect); -
492 if (proxyResizesWidget) {
evaluated: proxyResizesWidget
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:22
4-22
493 d->posChangeMode = QGraphicsProxyWidgetPrivate::NoMode; -
494 d->sizeChangeMode = QGraphicsProxyWidgetPrivate::NoMode; -
495 }
executed: }
Execution Count:4
4
496}
executed: }
Execution Count:26
26
497 -
498 -
499 -
500 -
501QVariant QGraphicsProxyWidget::itemChange(GraphicsItemChange change, -
502 const QVariant &value) -
503{ -
504 QGraphicsProxyWidgetPrivate * const d = d_func(); -
505 -
506 switch (change) { -
507 case ItemPositionChange: -
508 -
509 -
510 -
511 if (!d->posChangeMode)
never evaluated: !d->posChangeMode
0
512 d->posChangeMode = QGraphicsProxyWidgetPrivate::ProxyToWidgetMode;
never executed: d->posChangeMode = QGraphicsProxyWidgetPrivate::ProxyToWidgetMode;
0
513 break;
never executed: break;
0
514 case ItemPositionHasChanged: -
515 -
516 -
517 if (d->widget && d->posChangeMode != QGraphicsProxyWidgetPrivate::WidgetToProxyMode)
never evaluated: d->widget
never evaluated: d->posChangeMode != QGraphicsProxyWidgetPrivate::WidgetToProxyMode
0
518 d->widget->move(value.toPoint());
never executed: d->widget->move(value.toPoint());
0
519 if (d->posChangeMode == QGraphicsProxyWidgetPrivate::ProxyToWidgetMode)
never evaluated: d->posChangeMode == QGraphicsProxyWidgetPrivate::ProxyToWidgetMode
0
520 d->posChangeMode = QGraphicsProxyWidgetPrivate::NoMode;
never executed: d->posChangeMode = QGraphicsProxyWidgetPrivate::NoMode;
0
521 break;
never executed: break;
0
522 case ItemVisibleChange: -
523 if (!d->visibleChangeMode)
evaluated: !d->visibleChangeMode
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4
4-5
524 d->visibleChangeMode = QGraphicsProxyWidgetPrivate::ProxyToWidgetMode;
executed: d->visibleChangeMode = QGraphicsProxyWidgetPrivate::ProxyToWidgetMode;
Execution Count:5
5
525 break;
executed: break;
Execution Count:9
9
526 case ItemVisibleHasChanged: -
527 if (d->widget && d->visibleChangeMode != QGraphicsProxyWidgetPrivate::WidgetToProxyMode)
partially evaluated: d->widget
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
evaluated: d->visibleChangeMode != QGraphicsProxyWidgetPrivate::WidgetToProxyMode
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4
0-9
528 d->widget->setVisible(isVisible());
executed: d->widget->setVisible(isVisible());
Execution Count:5
5
529 if (d->visibleChangeMode == QGraphicsProxyWidgetPrivate::ProxyToWidgetMode)
evaluated: d->visibleChangeMode == QGraphicsProxyWidgetPrivate::ProxyToWidgetMode
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4
4-5
530 d->visibleChangeMode = QGraphicsProxyWidgetPrivate::NoMode;
executed: d->visibleChangeMode = QGraphicsProxyWidgetPrivate::NoMode;
Execution Count:5
5
531 break;
executed: break;
Execution Count:9
9
532 case ItemEnabledChange: -
533 if (!d->enabledChangeMode)
never evaluated: !d->enabledChangeMode
0
534 d->enabledChangeMode = QGraphicsProxyWidgetPrivate::ProxyToWidgetMode;
never executed: d->enabledChangeMode = QGraphicsProxyWidgetPrivate::ProxyToWidgetMode;
0
535 break;
never executed: break;
0
536 case ItemEnabledHasChanged: -
537 if (d->widget && d->enabledChangeMode != QGraphicsProxyWidgetPrivate::WidgetToProxyMode)
never evaluated: d->widget
never evaluated: d->enabledChangeMode != QGraphicsProxyWidgetPrivate::WidgetToProxyMode
0
538 d->widget->setEnabled(isEnabled());
never executed: d->widget->setEnabled(isEnabled());
0
539 if (d->enabledChangeMode == QGraphicsProxyWidgetPrivate::ProxyToWidgetMode)
never evaluated: d->enabledChangeMode == QGraphicsProxyWidgetPrivate::ProxyToWidgetMode
0
540 d->enabledChangeMode = QGraphicsProxyWidgetPrivate::NoMode;
never executed: d->enabledChangeMode = QGraphicsProxyWidgetPrivate::NoMode;
0
541 break;
never executed: break;
0
542 default: -
543 break;
executed: break;
Execution Count:57
57
544 } -
545 return QGraphicsWidget::itemChange(change, value);
executed: return QGraphicsWidget::itemChange(change, value);
Execution Count:75
75
546} -
547 -
548 -
549 -
550 -
551bool QGraphicsProxyWidget::event(QEvent *event) -
552{ -
553 QGraphicsProxyWidgetPrivate * const d = d_func(); -
554 if (!d->widget)
partially evaluated: !d->widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:58
0-58
555 return QGraphicsWidget::event(event);
never executed: return QGraphicsWidget::event(event);
0
556 -
557 switch (event->type()) { -
558 case QEvent::StyleChange: -
559 -
560 if (!d->styleChangeMode) {
never evaluated: !d->styleChangeMode
0
561 d->styleChangeMode = QGraphicsProxyWidgetPrivate::ProxyToWidgetMode; -
562 d->widget->setStyle(style()); -
563 d->styleChangeMode = QGraphicsProxyWidgetPrivate::NoMode; -
564 }
never executed: }
0
565 break;
never executed: break;
0
566 case QEvent::FontChange: { -
567 -
568 QWidgetPrivate *wd = d->widget->d_func(); -
569 int mask = d->font.resolve() | d->inheritedFontResolveMask; -
570 wd->inheritedFontResolveMask = mask; -
571 wd->resolveFont(); -
572 break;
never executed: break;
0
573 } -
574 case QEvent::PaletteChange: { -
575 -
576 QWidgetPrivate *wd = d->widget->d_func(); -
577 int mask = d->palette.resolve() | d->inheritedPaletteResolveMask; -
578 wd->inheritedPaletteResolveMask = mask; -
579 wd->resolvePalette(); -
580 break;
executed: break;
Execution Count:21
21
581 } -
582 case QEvent::InputMethod: { -
583 inputMethodEvent(static_cast<QInputMethodEvent *>(event)); -
584 break;
never executed: break;
0
585 } -
586 case QEvent::ShortcutOverride: { -
587 QWidget *focusWidget = d->widget->focusWidget(); -
588 while (focusWidget) {
never evaluated: focusWidget
0
589 QApplication::sendEvent(focusWidget, event); -
590 if (event->isAccepted())
never evaluated: event->isAccepted()
0
591 return true;
never executed: return true;
0
592 focusWidget = focusWidget->parentWidget(); -
593 }
never executed: }
0
594 return false;
never executed: return false;
0
595 } -
596 case QEvent::KeyPress: { -
597 QKeyEvent *k = static_cast<QKeyEvent *>(event); -
598 if (k->key() == Qt::Key_Tab || k->key() == Qt::Key_Backtab) {
never evaluated: k->key() == Qt::Key_Tab
never evaluated: k->key() == Qt::Key_Backtab
0
599 if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) {
never evaluated: !(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))
0
600 QWidget *focusWidget = d->widget->focusWidget(); -
601 while (focusWidget) {
never evaluated: focusWidget
0
602 bool res = QApplication::sendEvent(focusWidget, event); -
603 if ((res && event->isAccepted()) || (isWindow() && focusWidget == d->widget)) {
never evaluated: res
never evaluated: event->isAccepted()
never evaluated: isWindow()
never evaluated: focusWidget == d->widget
0
604 event->accept(); -
605 break;
never executed: break;
0
606 } -
607 focusWidget = focusWidget->parentWidget(); -
608 }
never executed: }
0
609 return true;
never executed: return true;
0
610 } -
611 }
never executed: }
0
612 break;
never executed: break;
0
613 } -
614 -
615 case QEvent::GraphicsSceneHelp: { -
616 -
617 if (d->lastWidgetUnderMouse) {
never evaluated: d->lastWidgetUnderMouse
0
618 QGraphicsSceneHelpEvent *he = static_cast<QGraphicsSceneHelpEvent *>(event); -
619 QPoint pos = d->mapToReceiver(mapFromScene(he->scenePos()), d->lastWidgetUnderMouse).toPoint(); -
620 QHelpEvent e(QEvent::ToolTip, pos, he->screenPos()); -
621 QApplication::sendEvent(d->lastWidgetUnderMouse, &e); -
622 event->setAccepted(e.isAccepted()); -
623 return e.isAccepted();
never executed: return e.isAccepted();
0
624 } -
625 break;
never executed: break;
0
626 } -
627 case QEvent::ToolTipChange: { -
628 -
629 if (!d->tooltipChangeMode) {
never evaluated: !d->tooltipChangeMode
0
630 d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::ProxyToWidgetMode; -
631 d->widget->setToolTip(toolTip()); -
632 d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::NoMode; -
633 }
never executed: }
0
634 break;
never executed: break;
0
635 } -
636 -
637 default: -
638 break;
executed: break;
Execution Count:37
37
639 } -
640 return QGraphicsWidget::event(event);
executed: return QGraphicsWidget::event(event);
Execution Count:58
58
641} -
642 -
643 -
644 -
645 -
646bool QGraphicsProxyWidget::eventFilter(QObject *object, QEvent *event) -
647{ -
648 QGraphicsProxyWidgetPrivate * const d = d_func(); -
649 -
650 if (object == d->widget) {
partially evaluated: object == d->widget
TRUEFALSE
yes
Evaluation Count:41
no
Evaluation Count:0
0-41
651 switch (event->type()) { -
652 case QEvent::LayoutRequest: -
653 updateGeometry(); -
654 break;
executed: break;
Execution Count:1
1
655 case QEvent::Resize: -
656 -
657 -
658 if (!d->sizeChangeMode)
partially evaluated: !d->sizeChangeMode
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
659 d->updateProxyGeometryFromWidget();
never executed: d->updateProxyGeometryFromWidget();
0
660 break;
executed: break;
Execution Count:3
3
661 case QEvent::Move: -
662 -
663 -
664 if (!d->posChangeMode)
never evaluated: !d->posChangeMode
0
665 d->updateProxyGeometryFromWidget();
never executed: d->updateProxyGeometryFromWidget();
0
666 break;
never executed: break;
0
667 case QEvent::Hide: -
668 case QEvent::Show: -
669 -
670 if (!d->visibleChangeMode) {
partially evaluated: !d->visibleChangeMode
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
671 d->visibleChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode; -
672 setVisible(event->type() == QEvent::Show); -
673 d->visibleChangeMode = QGraphicsProxyWidgetPrivate::NoMode; -
674 }
executed: }
Execution Count:4
4
675 break;
executed: break;
Execution Count:4
4
676 case QEvent::EnabledChange: -
677 -
678 if (!d->enabledChangeMode) {
never evaluated: !d->enabledChangeMode
0
679 d->enabledChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode; -
680 setEnabled(d->widget->isEnabled()); -
681 d->enabledChangeMode = QGraphicsProxyWidgetPrivate::NoMode; -
682 }
never executed: }
0
683 break;
never executed: break;
0
684 case QEvent::StyleChange: -
685 -
686 if (!d->styleChangeMode) {
never evaluated: !d->styleChangeMode
0
687 d->styleChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode; -
688 setStyle(d->widget->style()); -
689 d->styleChangeMode = QGraphicsProxyWidgetPrivate::NoMode; -
690 }
never executed: }
0
691 break;
never executed: break;
0
692 -
693 case QEvent::ToolTipChange: -
694 -
695 if (!d->tooltipChangeMode) {
never evaluated: !d->tooltipChangeMode
0
696 d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode; -
697 setToolTip(d->widget->toolTip()); -
698 d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::NoMode; -
699 }
never executed: }
0
700 break;
never executed: break;
0
701 -
702 default: -
703 break;
executed: break;
Execution Count:33
33
704 } -
705 }
executed: }
Execution Count:41
41
706 return QGraphicsWidget::eventFilter(object, event);
executed: return QGraphicsWidget::eventFilter(object, event);
Execution Count:41
41
707} -
708 -
709 -
710 -
711 -
712void QGraphicsProxyWidget::showEvent(QShowEvent *event) -
713{ -
714 (void)event;; -
715}
executed: }
Execution Count:5
5
716 -
717 -
718 -
719 -
720void QGraphicsProxyWidget::hideEvent(QHideEvent *event) -
721{ -
722 (void)event;; -
723}
executed: }
Execution Count:4
4
724 -
725 -
726 -
727 -
728 -
729void QGraphicsProxyWidget::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -
730{ -
731 QGraphicsProxyWidgetPrivate * const d = d_func(); -
732 if (!event || !d->widget || !d->widget->isVisible() || !hasFocus())
never evaluated: !event
never evaluated: !d->widget
never evaluated: !d->widget->isVisible()
never evaluated: !hasFocus()
0
733 return;
never executed: return;
0
734 -
735 -
736 QPointF pos = event->pos(); -
737 QPointer<QWidget> alienWidget = d->widget->childAt(pos.toPoint()); -
738 QPointer<QWidget> receiver = alienWidget ? alienWidget : d->widget;
never evaluated: alienWidget
0
739 -
740 -
741 pos = d->mapToReceiver(pos, receiver); -
742 -
743 QPoint globalPos = receiver->mapToGlobal(pos.toPoint()); -
744 -
745 -
746 -
747 -
748 -
749 if (bypassGraphicsProxyWidget(receiver))
never evaluated: bypassGraphicsProxyWidget(receiver)
0
750 globalPos = event->screenPos();
never executed: globalPos = event->screenPos();
0
751 -
752 -
753 QContextMenuEvent contextMenuEvent(QContextMenuEvent::Reason(event->reason()), -
754 pos.toPoint(), globalPos, event->modifiers()); -
755 QApplication::sendEvent(receiver, &contextMenuEvent); -
756 -
757 event->setAccepted(contextMenuEvent.isAccepted()); -
758}
never executed: }
0
759 -
760 -
761 -
762 -
763 -
764 -
765void QGraphicsProxyWidget::dragEnterEvent(QGraphicsSceneDragDropEvent *event) -
766{ -
767 -
768 -
769 -
770 QGraphicsProxyWidgetPrivate * const d = d_func(); -
771 if (!d->widget)
never evaluated: !d->widget
0
772 return;
never executed: return;
0
773 -
774 QDragEnterEvent proxyDragEnter(event->pos().toPoint(), event->dropAction(), event->mimeData(), event->buttons(), event->modifiers()); -
775 proxyDragEnter.setAccepted(event->isAccepted()); -
776 QApplication::sendEvent(d->widget, &proxyDragEnter); -
777 event->setAccepted(proxyDragEnter.isAccepted()); -
778 if (proxyDragEnter.isAccepted())
never evaluated: proxyDragEnter.isAccepted()
0
779 event->setDropAction(proxyDragEnter.dropAction());
never executed: event->setDropAction(proxyDragEnter.dropAction());
0
780 -
781}
never executed: }
0
782 -
783 -
784 -
785void QGraphicsProxyWidget::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) -
786{ -
787 (void)event;; -
788 -
789 QGraphicsProxyWidgetPrivate * const d = d_func(); -
790 if (!d->widget || !d->dragDropWidget)
never evaluated: !d->widget
never evaluated: !d->dragDropWidget
0
791 return;
never executed: return;
0
792 QDragLeaveEvent proxyDragLeave; -
793 QApplication::sendEvent(d->dragDropWidget, &proxyDragLeave); -
794 d->dragDropWidget = 0; -
795 -
796}
never executed: }
0
797 -
798 -
799 -
800 -
801void QGraphicsProxyWidget::dragMoveEvent(QGraphicsSceneDragDropEvent *event) -
802{ -
803 -
804 -
805 -
806 QGraphicsProxyWidgetPrivate * const d = d_func(); -
807 if (!d->widget)
never evaluated: !d->widget
0
808 return;
never executed: return;
0
809 QPointF p = event->pos(); -
810 event->ignore(); -
811 QPointer<QWidget> subWidget = d->widget->childAt(p.toPoint()); -
812 QPointer<QWidget> receiver = subWidget ? subWidget : d->widget;
never evaluated: subWidget
0
813 bool eventDelivered = false; -
814 for (; receiver; receiver = receiver->parentWidget()) {
never evaluated: receiver
0
815 if (!receiver->isEnabled() || !receiver->acceptDrops())
never evaluated: !receiver->isEnabled()
never evaluated: !receiver->acceptDrops()
0
816 continue;
never executed: continue;
0
817 -
818 QPoint receiverPos = d->mapToReceiver(p, receiver).toPoint(); -
819 if (receiver != d->dragDropWidget) {
never evaluated: receiver != d->dragDropWidget
0
820 -
821 QDragEnterEvent dragEnter(receiverPos, event->possibleActions(), event->mimeData(), event->buttons(), event->modifiers()); -
822 dragEnter.setDropAction(event->proposedAction()); -
823 QApplication::sendEvent(receiver, &dragEnter); -
824 event->setAccepted(dragEnter.isAccepted()); -
825 event->setDropAction(dragEnter.dropAction()); -
826 if (!event->isAccepted()) {
never evaluated: !event->isAccepted()
0
827 -
828 continue;
never executed: continue;
0
829 } -
830 -
831 d->lastDropAction = event->dropAction(); -
832 -
833 if (d->dragDropWidget) {
never evaluated: d->dragDropWidget
0
834 QDragLeaveEvent dragLeave; -
835 QApplication::sendEvent(d->dragDropWidget, &dragLeave); -
836 }
never executed: }
0
837 d->dragDropWidget = receiver; -
838 }
never executed: }
0
839 -
840 QDragMoveEvent dragMove(receiverPos, event->possibleActions(), event->mimeData(), event->buttons(), event->modifiers()); -
841 event->setDropAction(d->lastDropAction); -
842 QApplication::sendEvent(receiver, &dragMove); -
843 event->setAccepted(dragMove.isAccepted()); -
844 event->setDropAction(dragMove.dropAction()); -
845 if (event->isAccepted())
never evaluated: event->isAccepted()
0
846 d->lastDropAction = event->dropAction();
never executed: d->lastDropAction = event->dropAction();
0
847 eventDelivered = true; -
848 break;
never executed: break;
0
849 } -
850 -
851 if (!eventDelivered) {
never evaluated: !eventDelivered
0
852 if (d->dragDropWidget) {
never evaluated: d->dragDropWidget
0
853 -
854 QDragLeaveEvent dragLeave; -
855 QApplication::sendEvent(d->dragDropWidget, &dragLeave); -
856 d->dragDropWidget = 0; -
857 }
never executed: }
0
858 -
859 event->setDropAction(Qt::IgnoreAction); -
860 }
never executed: }
0
861 -
862}
never executed: }
0
863 -
864 -
865 -
866 -
867void QGraphicsProxyWidget::dropEvent(QGraphicsSceneDragDropEvent *event) -
868{ -
869 -
870 -
871 -
872 QGraphicsProxyWidgetPrivate * const d = d_func(); -
873 if (d->widget && d->dragDropWidget) {
never evaluated: d->widget
never evaluated: d->dragDropWidget
0
874 QPoint widgetPos = d->mapToReceiver(event->pos(), d->dragDropWidget).toPoint(); -
875 QDropEvent dropEvent(widgetPos, event->possibleActions(), event->mimeData(), event->buttons(), event->modifiers()); -
876 QApplication::sendEvent(d->dragDropWidget, &dropEvent); -
877 event->setAccepted(dropEvent.isAccepted()); -
878 d->dragDropWidget = 0; -
879 }
never executed: }
0
880 -
881}
never executed: }
0
882 -
883 -
884 -
885 -
886 -
887void QGraphicsProxyWidget::hoverEnterEvent(QGraphicsSceneHoverEvent *event) -
888{ -
889 (void)event;; -
890}
never executed: }
0
891 -
892 -
893 -
894 -
895void QGraphicsProxyWidget::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -
896{ -
897 (void)event;; -
898 QGraphicsProxyWidgetPrivate * const d = d_func(); -
899 -
900 if (d->lastWidgetUnderMouse) {
never evaluated: d->lastWidgetUnderMouse
0
901 QApplicationPrivate::dispatchEnterLeave(0, d->lastWidgetUnderMouse, event->screenPos()); -
902 d->lastWidgetUnderMouse = 0; -
903 }
never executed: }
0
904}
never executed: }
0
905 -
906 -
907 -
908 -
909void QGraphicsProxyWidget::hoverMoveEvent(QGraphicsSceneHoverEvent *event) -
910{ -
911 QGraphicsProxyWidgetPrivate * const d = d_func(); -
912 -
913 -
914 -
915 -
916 if (!d->widget || !rect().contains(event->pos())) {
never evaluated: !d->widget
never evaluated: !rect().contains(event->pos())
0
917 if (d->lastWidgetUnderMouse) {
never evaluated: d->lastWidgetUnderMouse
0
918 QApplicationPrivate::dispatchEnterLeave(0, d->lastWidgetUnderMouse, event->screenPos()); -
919 d->lastWidgetUnderMouse = 0; -
920 }
never executed: }
0
921 return;
never executed: return;
0
922 } -
923 -
924 d->embeddedMouseGrabber = 0; -
925 d->sendWidgetMouseEvent(event); -
926}
never executed: }
0
927 -
928 -
929 -
930 -
931void QGraphicsProxyWidget::grabMouseEvent(QEvent *event) -
932{ -
933 (void)event;; -
934}
never executed: }
0
935 -
936 -
937 -
938 -
939void QGraphicsProxyWidget::ungrabMouseEvent(QEvent *event) -
940{ -
941 QGraphicsProxyWidgetPrivate * const d = d_func(); -
942 (void)event;; -
943 d->embeddedMouseGrabber = 0; -
944}
never executed: }
0
945 -
946 -
947 -
948 -
949void QGraphicsProxyWidget::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -
950{ -
951 QGraphicsProxyWidgetPrivate * const d = d_func(); -
952 -
953 -
954 -
955 d->sendWidgetMouseEvent(event); -
956}
never executed: }
0
957 -
958 -
959 -
960 -
961void QGraphicsProxyWidget::mousePressEvent(QGraphicsSceneMouseEvent *event) -
962{ -
963 QGraphicsProxyWidgetPrivate * const d = d_func(); -
964 -
965 -
966 -
967 d->sendWidgetMouseEvent(event); -
968}
never executed: }
0
969 -
970 -
971 -
972 -
973void QGraphicsProxyWidget::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) -
974{ -
975 QGraphicsProxyWidgetPrivate * const d = d_func(); -
976 -
977 -
978 -
979 d->sendWidgetMouseEvent(event); -
980}
never executed: }
0
981 -
982 -
983 -
984 -
985 -
986void QGraphicsProxyWidget::wheelEvent(QGraphicsSceneWheelEvent *event) -
987{ -
988 QGraphicsProxyWidgetPrivate * const d = d_func(); -
989 -
990 -
991 -
992 if (!d->widget)
never evaluated: !d->widget
0
993 return;
never executed: return;
0
994 -
995 QPointF pos = event->pos(); -
996 QPointer<QWidget> receiver = d->widget->childAt(pos.toPoint()); -
997 if (!receiver)
never evaluated: !receiver
0
998 receiver = d->widget;
never executed: receiver = d->widget;
0
999 -
1000 -
1001 pos = d->mapToReceiver(pos, receiver); -
1002 -
1003 -
1004 QWheelEvent wheelEvent(pos.toPoint(), event->screenPos(), event->delta(), -
1005 event->buttons(), event->modifiers(), event->orientation()); -
1006 QPointer<QWidget> focusWidget = d->widget->focusWidget(); -
1007 extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); -
1008 qt_sendSpontaneousEvent(receiver, &wheelEvent); -
1009 event->setAccepted(wheelEvent.isAccepted()); -
1010 -
1011 -
1012 if (focusWidget && !focusWidget->hasFocus()) {
never evaluated: focusWidget
never evaluated: !focusWidget->hasFocus()
0
1013 focusWidget->update(); -
1014 focusWidget = d->widget->focusWidget(); -
1015 if (focusWidget && focusWidget->hasFocus())
never evaluated: focusWidget
never evaluated: focusWidget->hasFocus()
0
1016 focusWidget->update();
never executed: focusWidget->update();
0
1017 }
never executed: }
0
1018}
never executed: }
0
1019 -
1020 -
1021 -
1022 -
1023 -
1024void QGraphicsProxyWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -
1025{ -
1026 QGraphicsProxyWidgetPrivate * const d = d_func(); -
1027 -
1028 -
1029 -
1030 d->sendWidgetMouseEvent(event); -
1031}
never executed: }
0
1032 -
1033 -
1034 -
1035 -
1036void QGraphicsProxyWidget::keyPressEvent(QKeyEvent *event) -
1037{ -
1038 QGraphicsProxyWidgetPrivate * const d = d_func(); -
1039 -
1040 -
1041 -
1042 d->sendWidgetKeyEvent(event); -
1043}
never executed: }
0
1044 -
1045 -
1046 -
1047 -
1048void QGraphicsProxyWidget::keyReleaseEvent(QKeyEvent *event) -
1049{ -
1050 QGraphicsProxyWidgetPrivate * const d = d_func(); -
1051 -
1052 -
1053 -
1054 d->sendWidgetKeyEvent(event); -
1055}
never executed: }
0
1056 -
1057 -
1058 -
1059 -
1060void QGraphicsProxyWidget::focusInEvent(QFocusEvent *event) -
1061{ -
1062 -
1063 -
1064 -
1065 QGraphicsProxyWidgetPrivate * const d = d_func(); -
1066 -
1067 if (d->focusFromWidgetToProxy) {
never evaluated: d->focusFromWidgetToProxy
0
1068 -
1069 -
1070 -
1071 return;
never executed: return;
0
1072 } -
1073 -
1074 d->proxyIsGivingFocus = true; -
1075 -
1076 switch (event->reason()) { -
1077 case Qt::TabFocusReason: { -
1078 if (QWidget *focusChild = d->findFocusChild(0, true))
never evaluated: QWidget *focusChild = d->findFocusChild(0, true)
0
1079 focusChild->setFocus(event->reason());
never executed: focusChild->setFocus(event->reason());
0
1080 break;
never executed: break;
0
1081 } -
1082 case Qt::BacktabFocusReason: -
1083 if (QWidget *focusChild = d->findFocusChild(0, false))
never evaluated: QWidget *focusChild = d->findFocusChild(0, false)
0
1084 focusChild->setFocus(event->reason());
never executed: focusChild->setFocus(event->reason());
0
1085 break;
never executed: break;
0
1086 default: -
1087 if (d->widget && d->widget->focusWidget()) {
never evaluated: d->widget
never evaluated: d->widget->focusWidget()
0
1088 d->widget->focusWidget()->setFocus(event->reason()); -
1089 }
never executed: }
0
1090 break;
never executed: break;
0
1091 } -
1092 -
1093 d->proxyIsGivingFocus = false; -
1094}
never executed: }
0
1095 -
1096 -
1097 -
1098 -
1099void QGraphicsProxyWidget::focusOutEvent(QFocusEvent *event) -
1100{ -
1101 -
1102 -
1103 -
1104 QGraphicsProxyWidgetPrivate * const d = d_func(); -
1105 if (d->widget) {
never evaluated: d->widget
0
1106 -
1107 -
1108 if (QWidget *focusWidget = d->widget->focusWidget())
never evaluated: QWidget *focusWidget = d->widget->focusWidget()
0
1109 d->removeSubFocusHelper(focusWidget, event->reason());
never executed: d->removeSubFocusHelper(focusWidget, event->reason());
0
1110 }
never executed: }
0
1111}
never executed: }
0
1112 -
1113 -
1114 -
1115 -
1116bool QGraphicsProxyWidget::focusNextPrevChild(bool next) -
1117{ -
1118 QGraphicsProxyWidgetPrivate * const d = d_func(); -
1119 if (!d->widget || !d->scene)
never evaluated: !d->widget
never evaluated: !d->scene
0
1120 return QGraphicsWidget::focusNextPrevChild(next);
never executed: return QGraphicsWidget::focusNextPrevChild(next);
0
1121 -
1122 Qt::FocusReason reason = next ? Qt::TabFocusReason : Qt::BacktabFocusReason;
never evaluated: next
0
1123 QWidget *lastFocusChild = d->widget->focusWidget(); -
1124 if (QWidget *newFocusChild = d->findFocusChild(lastFocusChild, next)) {
never evaluated: QWidget *newFocusChild = d->findFocusChild(lastFocusChild, next)
0
1125 newFocusChild->setFocus(reason); -
1126 return true;
never executed: return true;
0
1127 } -
1128 -
1129 return QGraphicsWidget::focusNextPrevChild(next);
never executed: return QGraphicsWidget::focusNextPrevChild(next);
0
1130} -
1131 -
1132 -
1133 -
1134 -
1135QVariant QGraphicsProxyWidget::inputMethodQuery(Qt::InputMethodQuery query) const -
1136{ -
1137 const QGraphicsProxyWidgetPrivate * const d = d_func(); -
1138 -
1139 if (!d->widget || !hasFocus())
never evaluated: !d->widget
never evaluated: !hasFocus()
0
1140 return QVariant();
never executed: return QVariant();
0
1141 -
1142 QWidget *focusWidget = widget()->focusWidget(); -
1143 if (!focusWidget)
never evaluated: !focusWidget
0
1144 focusWidget = d->widget;
never executed: focusWidget = d->widget;
0
1145 QVariant v = focusWidget->inputMethodQuery(query); -
1146 QPointF focusWidgetPos = subWidgetRect(focusWidget).topLeft(); -
1147 switch (v.type()) { -
1148 case QVariant::RectF: -
1149 v = v.toRectF().translated(focusWidgetPos); -
1150 break;
never executed: break;
0
1151 case QVariant::PointF: -
1152 v = v.toPointF() + focusWidgetPos; -
1153 break;
never executed: break;
0
1154 case QVariant::Rect: -
1155 v = v.toRect().translated(focusWidgetPos.toPoint()); -
1156 break;
never executed: break;
0
1157 case QVariant::Point: -
1158 v = v.toPoint() + focusWidgetPos.toPoint(); -
1159 break;
never executed: break;
0
1160 default: -
1161 break;
never executed: break;
0
1162 } -
1163 return v;
never executed: return v;
0
1164} -
1165 -
1166 -
1167 -
1168 -
1169void QGraphicsProxyWidget::inputMethodEvent(QInputMethodEvent *event) -
1170{ -
1171 -
1172 const QGraphicsProxyWidgetPrivate * const d = d_func(); -
1173 QWidget *focusWidget = d->widget->focusWidget(); -
1174 if (focusWidget && focusWidget->testAttribute(Qt::WA_InputMethodEnabled))
never evaluated: focusWidget
never evaluated: focusWidget->testAttribute(Qt::WA_InputMethodEnabled)
0
1175 QApplication::sendEvent(focusWidget, event);
never executed: QApplication::sendEvent(focusWidget, event);
0
1176}
never executed: }
0
1177 -
1178 -
1179 -
1180 -
1181QSizeF QGraphicsProxyWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const -
1182{ -
1183 const QGraphicsProxyWidgetPrivate * const d = d_func(); -
1184 if (!d->widget)
partially evaluated: !d->widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36
0-36
1185 return QGraphicsWidget::sizeHint(which, constraint);
never executed: return QGraphicsWidget::sizeHint(which, constraint);
0
1186 -
1187 QSizeF sh; -
1188 switch (which) { -
1189 case Qt::PreferredSize: -
1190 if (QLayout *l = d->widget->layout())
partially evaluated: QLayout *l = d->widget->layout()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1191 sh = l->sizeHint();
never executed: sh = l->sizeHint();
0
1192 else -
1193 sh = d->widget->sizeHint();
executed: sh = d->widget->sizeHint();
Execution Count:15
15
1194 break;
executed: break;
Execution Count:15
15
1195 case Qt::MinimumSize: -
1196 if (QLayout *l = d->widget->layout())
partially evaluated: QLayout *l = d->widget->layout()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1197 sh = l->minimumSize();
never executed: sh = l->minimumSize();
0
1198 else -
1199 sh = d->widget->minimumSizeHint();
executed: sh = d->widget->minimumSizeHint();
Execution Count:15
15
1200 break;
executed: break;
Execution Count:15
15
1201 case Qt::MaximumSize: -
1202 if (QLayout *l = d->widget->layout())
partially evaluated: QLayout *l = d->widget->layout()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
1203 sh = l->maximumSize();
never executed: sh = l->maximumSize();
0
1204 else -
1205 sh = QSizeF(((1<<24)-1), ((1<<24)-1));
executed: sh = QSizeF(((1<<24)-1), ((1<<24)-1));
Execution Count:6
6
1206 break;
executed: break;
Execution Count:6
6
1207 case Qt::MinimumDescent: -
1208 sh = constraint; -
1209 break;
never executed: break;
0
1210 default: -
1211 break;
never executed: break;
0
1212 } -
1213 return sh;
executed: return sh;
Execution Count:36
36
1214} -
1215 -
1216 -
1217 -
1218 -
1219void QGraphicsProxyWidget::resizeEvent(QGraphicsSceneResizeEvent *event) -
1220{ -
1221 QGraphicsProxyWidgetPrivate * const d = d_func(); -
1222 if (d->widget) {
partially evaluated: d->widget
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
0-13
1223 if (d->sizeChangeMode != QGraphicsProxyWidgetPrivate::WidgetToProxyMode)
evaluated: d->sizeChangeMode != QGraphicsProxyWidgetPrivate::WidgetToProxyMode
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:10
3-10
1224 d->widget->resize(event->newSize().toSize());
executed: d->widget->resize(event->newSize().toSize());
Execution Count:3
3
1225 }
executed: }
Execution Count:13
13
1226 QGraphicsWidget::resizeEvent(event); -
1227}
executed: }
Execution Count:13
13
1228 -
1229 -
1230 -
1231 -
1232void QGraphicsProxyWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -
1233{ -
1234 QGraphicsProxyWidgetPrivate * const d = d_func(); -
1235 (void)widget;; -
1236 if (!d->widget || !d->widget->isVisible())
partially evaluated: !d->widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
partially evaluated: !d->widget->isVisible()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1237 return;
never executed: return;
0
1238 -
1239 -
1240 const QRect exposedWidgetRect = (option->exposedRect & rect()).toAlignedRect(); -
1241 if (exposedWidgetRect.isEmpty())
partially evaluated: exposedWidgetRect.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1242 return;
never executed: return;
0
1243 -
1244 d->widget->render(painter, exposedWidgetRect.topLeft(), exposedWidgetRect); -
1245}
executed: }
Execution Count:8
8
1246 -
1247 -
1248 -
1249 -
1250int QGraphicsProxyWidget::type() const -
1251{ -
1252 return Type;
never executed: return Type;
0
1253} -
1254QGraphicsProxyWidget *QGraphicsProxyWidget::createProxyForChildWidget(QWidget *child) -
1255{ -
1256 QGraphicsProxyWidget *proxy = child->graphicsProxyWidget(); -
1257 if (proxy)
never evaluated: proxy
0
1258 return proxy;
never executed: return proxy;
0
1259 if (!child->parentWidget()) {
never evaluated: !child->parentWidget()
0
1260 QMessageLogger("graphicsview/qgraphicsproxywidget.cpp", 1519, __PRETTY_FUNCTION__).warning("QGraphicsProxyWidget::createProxyForChildWidget: top-level widget not in a QGraphicsScene"); -
1261 return 0;
never executed: return 0;
0
1262 } -
1263 -
1264 QGraphicsProxyWidget *parentProxy = createProxyForChildWidget(child->parentWidget()); -
1265 if (!parentProxy)
never evaluated: !parentProxy
0
1266 return 0;
never executed: return 0;
0
1267 -
1268 if (!QMetaObject::invokeMethod(parentProxy, "newProxyWidget", Qt::DirectConnection, 0
1269 QReturnArgument<QGraphicsProxyWidget* >("QGraphicsProxyWidget*", proxy), QArgument<const QWidget* >("const QWidget*", child)))
never evaluated: !QMetaObject::invokeMethod(parentProxy, "newProxyWidget", Qt::DirectConnection, QReturnArgument<QGraphicsProxyWidget* >("QGraphicsProxyWidget*", proxy), QArgument<const QWidget* >("const QWidget*", child))
0
1270 return 0;
never executed: return 0;
0
1271 proxy->setParent(parentProxy); -
1272 proxy->setWidget(child); -
1273 return proxy;
never executed: return proxy;
0
1274} -
1275QGraphicsProxyWidget *QGraphicsProxyWidget::newProxyWidget(const QWidget *) -
1276{ -
1277 return new QGraphicsProxyWidget(this);
never executed: return new QGraphicsProxyWidget(this);
0
1278} -
1279 -
1280 -
1281 -
1282 -
1283 -
1284 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial