qgraphicswidget.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/graphicsview/qgraphicswidget.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12QGraphicsWidget::QGraphicsWidget(QGraphicsItem *parent, Qt::WindowFlags wFlags)-
13 : QGraphicsObject(*new QGraphicsWidgetPrivate, 0), QGraphicsLayoutItem(0, false)-
14{-
15 QGraphicsWidgetPrivate * const d = d_func();-
16 d->init(parent, wFlags);-
17}-
18-
19-
20-
21-
22-
23-
24QGraphicsWidget::QGraphicsWidget(QGraphicsWidgetPrivate &dd, QGraphicsItem *parent, Qt::WindowFlags wFlags)-
25 : QGraphicsObject(dd, 0), QGraphicsLayoutItem(0, false)-
26{-
27 QGraphicsWidgetPrivate * const d = d_func();-
28 d->init(parent, wFlags);-
29}-
30class QGraphicsWidgetStyles-
31{-
32public:-
33 QStyle *styleForWidget(const QGraphicsWidget *widget) const-
34 {-
35 QMutexLocker locker(&mutex);-
36 return styles.value(widget, 0);-
37 }-
38-
39 void setStyleForWidget(QGraphicsWidget *widget, QStyle *style)-
40 {-
41 QMutexLocker locker(&mutex);-
42 if (style)-
43 styles[widget] = style;-
44 else-
45 styles.remove(widget);-
46 }-
47-
48private:-
49 QHash<const QGraphicsWidget *, QStyle *> styles;-
50 mutable QMutex mutex;-
51};-
52namespace { namespace Q_QGS_widgetStyles { typedef QGraphicsWidgetStyles Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QGraphicsWidgetStyles, Q_QGS_widgetStyles::innerFunction, Q_QGS_widgetStyles::guard> widgetStyles;-
53-
54-
55-
56-
57QGraphicsWidget::~QGraphicsWidget()-
58{-
59 QGraphicsWidgetPrivate * const d = d_func();-
60-
61-
62 for (int i = 0; i < d->actions.size()
i < d->actions.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
63 QActionPrivate *apriv = d->actions.at(i)->d_func();-
64 apriv->graphicsWidgets.removeAll(this);-
65 }
never executed: end of block
0
66 d->actions.clear();-
67-
68-
69 if (QGraphicsScene *scn = scene()
QGraphicsScene *scn = scene()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
70 QGraphicsScenePrivate *sceneD = scn->d_func();-
71 if (sceneD->tabFocusFirst == this
sceneD->tabFocusFirst == thisDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
72 sceneD->tabFocusFirst = (d->focusNext == this
d->focusNext == thisDescription
TRUEnever evaluated
FALSEnever evaluated
? 0 : d->focusNext);
never executed: sceneD->tabFocusFirst = (d->focusNext == this ? 0 : d->focusNext);
0
73 }
never executed: end of block
0
74 d->focusPrev->d_func()->focusNext = d->focusNext;-
75 d->focusNext->d_func()->focusPrev = d->focusPrev;-
76-
77-
78 d->focusNext = this;-
79 d->focusPrev = this;-
80-
81 clearFocus();-
82-
83-
84 if (d->layout
d->layoutDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
85 QGraphicsLayout *temp = d->layout;-
86 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(childItems())>::type> _container_((childItems())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^const auto items = 1)childItems();-
87 for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0: items) {-
88-
89-
90-
91 if (item->isWidget()
item->isWidget()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
92 QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item);-
93 if (widget->parentLayoutItem() == d->layout
widget->parent...) == d->layoutDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
94 widget->setParentLayoutItem(0);
never executed: widget->setParentLayoutItem(0);
0
95 }
never executed: end of block
0
96 }
never executed: end of block
0
97 d->layout = 0;-
98 delete temp;-
99 }
never executed: end of block
0
100-
101-
102 widgetStyles()->setStyleForWidget(this, 0);-
103-
104-
105-
106-
107 setParentItem(nullptr);-
108}
never executed: end of block
0
109QSizeF QGraphicsWidget::size() const-
110{-
111 return QGraphicsLayoutItem::geometry().size();-
112}-
113-
114void QGraphicsWidget::resize(const QSizeF &size)-
115{-
116 setGeometry(QRectF(pos(), size));-
117}-
118void QGraphicsWidget::setGeometry(const QRectF &rect)-
119{-
120 QGraphicsWidgetPrivate *wd = QGraphicsWidget::d_func();-
121 QGraphicsLayoutItemPrivate *d = QGraphicsLayoutItem::d_ptr.data();-
122 QRectF newGeom;-
123 QPointF oldPos = d->geom.topLeft();-
124 if (!wd->inSetPos) {-
125 setAttribute(Qt::WA_Resized);-
126 newGeom = rect;-
127 newGeom.setSize(rect.size().expandedTo(effectiveSizeHint(Qt::MinimumSize))-
128 .boundedTo(effectiveSizeHint(Qt::MaximumSize)));-
129-
130 if (newGeom == d->geom) {-
131 goto relayoutChildrenAndReturn;-
132 }-
133-
134-
135 wd->inSetGeometry = 1;-
136 setPos(newGeom.topLeft());-
137 wd->inSetGeometry = 0;-
138 newGeom.moveTopLeft(pos());-
139-
140 if (newGeom == d->geom) {-
141 goto relayoutChildrenAndReturn;-
142 }-
143-
144-
145 if (wd->scene) {-
146 if (rect.topLeft() == d->geom.topLeft()) {-
147 prepareGeometryChange();-
148 }-
149 }-
150 }-
151-
152-
153 {-
154 bool moved = oldPos != pos();-
155 if (moved) {-
156-
157 QGraphicsSceneMoveEvent event;-
158 event.setOldPos(oldPos);-
159 event.setNewPos(pos());-
160 QApplication::sendEvent(this, &event);-
161 if (wd->inSetPos) {-
162-
163 d->geom.moveTopLeft(pos());-
164 geometryChanged();-
165 goto relayoutChildrenAndReturn;-
166 }-
167 }-
168 QSizeF oldSize = size();-
169 QGraphicsLayoutItem::setGeometry(newGeom);-
170-
171 bool resized = newGeom.size() != oldSize;-
172 if (resized) {-
173 QGraphicsSceneResizeEvent re;-
174 re.setOldSize(oldSize);-
175 re.setNewSize(newGeom.size());-
176 if (oldSize.width() != newGeom.size().width())-
177 widthChanged();-
178 if (oldSize.height() != newGeom.size().height())-
179 heightChanged();-
180 QGraphicsLayout *lay = wd->layout;-
181 if (QGraphicsLayout::instantInvalidatePropagation()) {-
182 if (!lay || lay->isActivated()) {-
183 QApplication::sendEvent(this, &re);-
184 }-
185 } else {-
186 QApplication::sendEvent(this, &re);-
187 }-
188 }-
189 }-
190-
191 geometryChanged();-
192relayoutChildrenAndReturn:-
193 if (QGraphicsLayout::instantInvalidatePropagation()) {-
194 if (QGraphicsLayout *lay = wd->layout) {-
195 if (!lay->isActivated()) {-
196 QEvent layoutRequest(QEvent::LayoutRequest);-
197 QApplication::sendEvent(this, &layoutRequest);-
198 }-
199 }-
200 }-
201}-
202void QGraphicsWidget::setContentsMargins(qreal left, qreal top, qreal right, qreal bottom)-
203{-
204 QGraphicsWidgetPrivate * const d = d_func();-
205-
206 if (!d->margins && left == 0 && top == 0 && right == 0 && bottom == 0)-
207 return;-
208 d->ensureMargins();-
209 if (left == d->margins[d->Left]-
210 && top == d->margins[d->Top]-
211 && right == d->margins[d->Right]-
212 && bottom == d->margins[d->Bottom])-
213 return;-
214-
215 d->margins[d->Left] = left;-
216 d->margins[d->Top] = top;-
217 d->margins[d->Right] = right;-
218 d->margins[d->Bottom] = bottom;-
219-
220 if (QGraphicsLayout *l = d->layout)-
221 l->invalidate();-
222 else-
223 updateGeometry();-
224-
225 QEvent e(QEvent::ContentsRectChange);-
226 QApplication::sendEvent(this, &e);-
227}-
228void QGraphicsWidget::getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const-
229{-
230 const QGraphicsWidgetPrivate * const d = d_func();-
231 if (left || top || right || bottom)-
232 d->ensureMargins();-
233 if (left)-
234 *left = d->margins[d->Left];-
235 if (top)-
236 *top = d->margins[d->Top];-
237 if (right)-
238 *right = d->margins[d->Right];-
239 if (bottom)-
240 *bottom = d->margins[d->Bottom];-
241}-
242void QGraphicsWidget::setWindowFrameMargins(qreal left, qreal top, qreal right, qreal bottom)-
243{-
244 QGraphicsWidgetPrivate * const d = d_func();-
245-
246 if (!d->windowFrameMargins && left == 0 && top == 0 && right == 0 && bottom == 0)-
247 return;-
248 d->ensureWindowFrameMargins();-
249 bool unchanged =-
250 d->windowFrameMargins[d->Left] == left-
251 && d->windowFrameMargins[d->Top] == top-
252 && d->windowFrameMargins[d->Right] == right-
253 && d->windowFrameMargins[d->Bottom] == bottom;-
254 if (d->setWindowFrameMargins && unchanged)-
255 return;-
256 if (!unchanged)-
257 prepareGeometryChange();-
258 d->windowFrameMargins[d->Left] = left;-
259 d->windowFrameMargins[d->Top] = top;-
260 d->windowFrameMargins[d->Right] = right;-
261 d->windowFrameMargins[d->Bottom] = bottom;-
262 d->setWindowFrameMargins = true;-
263}-
264void QGraphicsWidget::getWindowFrameMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const-
265{-
266 const QGraphicsWidgetPrivate * const d = d_func();-
267 if (left || top || right || bottom)-
268 d->ensureWindowFrameMargins();-
269 if (left)-
270 *left = d->windowFrameMargins[d->Left];-
271 if (top)-
272 *top = d->windowFrameMargins[d->Top];-
273 if (right)-
274 *right = d->windowFrameMargins[d->Right];-
275 if (bottom)-
276 *bottom = d->windowFrameMargins[d->Bottom];-
277}-
278-
279-
280-
281-
282-
283-
284void QGraphicsWidget::unsetWindowFrameMargins()-
285{-
286 QGraphicsWidgetPrivate * const d = d_func();-
287 if ((d->windowFlags & Qt::Window) && (d->windowFlags & Qt::WindowType_Mask) != Qt::Popup &&-
288 (d->windowFlags & Qt::WindowType_Mask) != Qt::ToolTip && !(d->windowFlags & Qt::FramelessWindowHint)) {-
289 QStyleOptionTitleBar bar;-
290 d->initStyleOptionTitleBar(&bar);-
291 QStyle *style = this->style();-
292 qreal margin = style->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth);-
293 qreal titleBarHeight = d->titleBarHeight(bar);-
294 setWindowFrameMargins(margin, titleBarHeight, margin, margin);-
295 } else {-
296 setWindowFrameMargins(0, 0, 0, 0);-
297 }-
298 d->setWindowFrameMargins = false;-
299}-
300-
301-
302-
303-
304-
305-
306-
307QRectF QGraphicsWidget::windowFrameGeometry() const-
308{-
309 const QGraphicsWidgetPrivate * const d = d_func();-
310 return d->windowFrameMargins-
311 ? geometry().adjusted(-d->windowFrameMargins[d->Left], -d->windowFrameMargins[d->Top],-
312 d->windowFrameMargins[d->Right], d->windowFrameMargins[d->Bottom])-
313 : geometry();-
314}-
315-
316-
317-
318-
319-
320-
321QRectF QGraphicsWidget::windowFrameRect() const-
322{-
323 const QGraphicsWidgetPrivate * const d = d_func();-
324 return d->windowFrameMargins-
325 ? rect().adjusted(-d->windowFrameMargins[d->Left], -d->windowFrameMargins[d->Top],-
326 d->windowFrameMargins[d->Right], d->windowFrameMargins[d->Bottom])-
327 : rect();-
328}-
329void QGraphicsWidget::initStyleOption(QStyleOption *option) const-
330{-
331 ((!(option)) ? qt_assert("option",__FILE__,685692) : qt_noop());-
332-
333 option->state = QStyle::State_None;-
334 if (isEnabled())-
335 option->state |= QStyle::State_Enabled;-
336 if (hasFocus())-
337 option->state |= QStyle::State_HasFocus;-
338-
339-
340 if (isUnderMouse())-
341 option->state |= QStyle::State_MouseOver;-
342 if (QGraphicsWidget *w = window()) {-
343 if (w->isActiveWindow())-
344 option->state |= QStyle::State_Active;-
345 }-
346 if (isWindow())-
347 option->state |= QStyle::State_Window;-
348 option->direction = layoutDirection();-
349 option->rect = rect().toRect();-
350 option->palette = palette();-
351 if (!isEnabled()) {-
352 option->palette.setCurrentColorGroup(QPalette::Disabled);-
353 } else if (isActiveWindow()) {-
354 option->palette.setCurrentColorGroup(QPalette::Active);-
355 } else {-
356 option->palette.setCurrentColorGroup(QPalette::Inactive);-
357 }-
358 option->fontMetrics = QFontMetrics(font());-
359 option->styleObject = const_cast<QGraphicsWidget *>(this);-
360}-
361-
362-
363-
364-
365QSizeF QGraphicsWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const-
366{-
367 const QGraphicsWidgetPrivate * const d = d_func();-
368 QSizeF sh;-
369 if (d->layout) {-
370 QSizeF marginSize(0,0);-
371 if (d->margins) {-
372 marginSize = QSizeF(d->margins[d->Left] + d->margins[d->Right],-
373 d->margins[d->Top] + d->margins[d->Bottom]);-
374 }-
375 sh = d->layout->effectiveSizeHint(which, constraint - marginSize);-
376 sh += marginSize;-
377 } else {-
378 switch (which) {-
379 case Qt::MinimumSize:-
380 sh = QSizeF(0, 0);-
381 break;-
382 case Qt::PreferredSize:-
383 sh = QSizeF(50, 50);-
384 break;-
385 case Qt::MaximumSize:-
386 sh = QSizeF(((1<<24)-1), ((1<<24)-1));-
387 break;-
388 default:-
389 QMessageLogger(__FILE__, 766773, __PRETTY_FUNCTION__).warning("QGraphicsWidget::sizeHint(): Don't know how to handle the value of 'which'");-
390 break;-
391 }-
392 }-
393 return sh;-
394}-
395QGraphicsLayout *QGraphicsWidget::layout() const-
396{-
397 const QGraphicsWidgetPrivate * const d = d_func();-
398 return d->layout;-
399}-
400void QGraphicsWidget::setLayout(QGraphicsLayout *l)-
401{-
402 QGraphicsWidgetPrivate * const d = d_func();-
403 if (d->layout == l)-
404 return;-
405 d->setLayout_helper(l);-
406 if (!l)-
407 return;-
408-
409-
410 QGraphicsLayoutItem *oldParent = l->parentLayoutItem();-
411 if (oldParent && oldParent != this) {-
412 QMessageLogger(__FILE__, 843850, __PRETTY_FUNCTION__).warning("QGraphicsWidget::setLayout: Attempting to set a layout on %s"-
413 " \"%s\", when the layout already has a parent",-
414 metaObject()->className(), QString(objectName()).toLocal8Bit().constData());-
415 return;-
416 }-
417-
418-
419 l->setParentLayoutItem(this);-
420 l->d_func()->reparentChildItems(this);-
421 l->invalidate();-
422 layoutChanged();-
423}-
424void QGraphicsWidget::adjustSize()-
425{-
426 QSizeF sz = effectiveSizeHint(Qt::PreferredSize);-
427-
428 if (sz.isValid())-
429 resize(sz);-
430}-
431Qt::LayoutDirection QGraphicsWidget::layoutDirection() const-
432{-
433 return testAttribute(Qt::WA_RightToLeft) ? Qt::RightToLeft : Qt::LeftToRight;-
434}-
435void QGraphicsWidget::setLayoutDirection(Qt::LayoutDirection direction)-
436{-
437 QGraphicsWidgetPrivate * const d = d_func();-
438 setAttribute(Qt::WA_SetLayoutDirection, true);-
439 d->setLayoutDirection_helper(direction);-
440}-
441void QGraphicsWidget::unsetLayoutDirection()-
442{-
443 QGraphicsWidgetPrivate * const d = d_func();-
444 setAttribute(Qt::WA_SetLayoutDirection, false);-
445 d->resolveLayoutDirection();-
446}-
447QStyle *QGraphicsWidget::style() const-
448{-
449 if (QStyle *style = widgetStyles()->styleForWidget(this))-
450 return style;-
451-
452 return scene() ? scene()->style() : QApplication::style();-
453}-
454void QGraphicsWidget::setStyle(QStyle *style)-
455{-
456 setAttribute(Qt::WA_SetStyle, style != 0);-
457 widgetStyles()->setStyleForWidget(this, style);-
458-
459-
460 QEvent event(QEvent::StyleChange);-
461 QApplication::sendEvent(this, &event);-
462}-
463QFont QGraphicsWidget::font() const-
464{-
465 const QGraphicsWidgetPrivate * const d = d_func();-
466 QFont fnt = d->font;-
467 fnt.resolve(fnt.resolve() | d->inheritedFontResolveMask);-
468 return fnt;-
469}-
470void QGraphicsWidget::setFont(const QFont &font)-
471{-
472 QGraphicsWidgetPrivate * const d = d_func();-
473 setAttribute(Qt::WA_SetFont, font.resolve() != 0);-
474-
475 QFont naturalFont = d->naturalWidgetFont();-
476 QFont resolvedFont = font.resolve(naturalFont);-
477 d->setFont_helper(resolvedFont);-
478}-
479QPalette QGraphicsWidget::palette() const-
480{-
481 const QGraphicsWidgetPrivate * const d = d_func();-
482 return d->palette;-
483}-
484void QGraphicsWidget::setPalette(const QPalette &palette)-
485{-
486 QGraphicsWidgetPrivate * const d = d_func();-
487 setAttribute(Qt::WA_SetPalette, palette.resolve() != 0);-
488-
489 QPalette naturalPalette = d->naturalWidgetPalette();-
490 QPalette resolvedPalette = palette.resolve(naturalPalette);-
491 d->setPalette_helper(resolvedPalette);-
492}-
493bool QGraphicsWidget::autoFillBackground() const-
494{-
495 const QGraphicsWidgetPrivate * const d = d_func();-
496 return d->autoFillBackground;-
497}-
498void QGraphicsWidget::setAutoFillBackground(bool enabled)-
499{-
500 QGraphicsWidgetPrivate * const d = d_func();-
501 if (d->autoFillBackground != enabled) {-
502 d->autoFillBackground = enabled;-
503 update();-
504 }-
505}-
506void QGraphicsWidget::updateGeometry()-
507{-
508 QGraphicsLayoutItem::updateGeometry();-
509 QGraphicsLayoutItem *parentItem = parentLayoutItem();-
510-
511 if (parentItem && parentItem->isLayout()) {-
512 if (QGraphicsLayout::instantInvalidatePropagation()) {-
513 static_cast<QGraphicsLayout *>(parentItem)->invalidate();-
514 } else {-
515 parentItem->updateGeometry();-
516 }-
517 } else {-
518 if (parentItem) {-
519-
520 QGraphicsWidget *parentWid = parentWidget();-
521 if (parentWid->isVisible())-
522 QApplication::postEvent(parentWid, new QEvent(QEvent::LayoutRequest));-
523 } else {-
524-
525-
526-
527-
528-
529 if (QGraphicsLayout::instantInvalidatePropagation())-
530 QApplication::postEvent(static_cast<QGraphicsWidget *>(this), new QEvent(QEvent::LayoutRequest));-
531 }-
532 if (!QGraphicsLayout::instantInvalidatePropagation()) {-
533 bool wasResized = testAttribute(Qt::WA_Resized);-
534 resize(size());-
535 setAttribute(Qt::WA_Resized, wasResized);-
536 }-
537 }-
538}-
539QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &value)-
540{-
541 QGraphicsWidgetPrivate * const d = d_func();-
542 switch (change) {-
543 case ItemEnabledHasChanged: {-
544-
545 QEvent event(QEvent::EnabledChange);-
546 QApplication::sendEvent(this, &event);-
547 break;-
548 }-
549 case ItemVisibleChange:-
550 if (value.toBool()) {-
551-
552 QShowEvent event;-
553 QApplication::sendEvent(this, &event);-
554 bool resized = testAttribute(Qt::WA_Resized);-
555 if (!resized) {-
556 adjustSize();-
557 setAttribute(Qt::WA_Resized, false);-
558 }-
559 }-
560-
561-
562 if (value.toBool() || d->explicitlyHidden)-
563 updateGeometry();-
564 break;-
565 case ItemVisibleHasChanged:-
566 if (!value.toBool()) {-
567-
568 QHideEvent event;-
569 QApplication::sendEvent(this, &event);-
570 }-
571 break;-
572 case ItemPositionHasChanged:-
573 d->setGeometryFromSetPos();-
574 break;-
575 case ItemParentChange: {-
576-
577 QEvent event(QEvent::ParentAboutToChange);-
578 QApplication::sendEvent(this, &event);-
579 break;-
580 }-
581 case ItemParentHasChanged: {-
582-
583 QEvent event(QEvent::ParentChange);-
584 QApplication::sendEvent(this, &event);-
585 break;-
586 }-
587 case ItemCursorHasChanged: {-
588-
589 QEvent event(QEvent::CursorChange);-
590 QApplication::sendEvent(this, &event);-
591 break;-
592 }-
593 case ItemToolTipHasChanged: {-
594-
595 QEvent event(QEvent::ToolTipChange);-
596 QApplication::sendEvent(this, &event);-
597 break;-
598 }-
599 default:-
600 break;-
601 }-
602 return QGraphicsItem::itemChange(change, value);-
603}-
604QVariant QGraphicsWidget::propertyChange(const QString &propertyName, const QVariant &value)-
605{-
606 (void)propertyName;;-
607 return value;-
608}-
609bool QGraphicsWidget::sceneEvent(QEvent *event)-
610{-
611 return QGraphicsItem::sceneEvent(event);-
612}-
613bool QGraphicsWidget::windowFrameEvent(QEvent *event)-
614{-
615 QGraphicsWidgetPrivate * const d = d_func();-
616 switch (event->type()) {-
617 case QEvent::GraphicsSceneMousePress:-
618 d->windowFrameMousePressEvent(static_cast<QGraphicsSceneMouseEvent *>(event));-
619 break;-
620 case QEvent::GraphicsSceneMouseMove:-
621 d->ensureWindowData();-
622 if (d->windowData->grabbedSection != Qt::NoSection) {-
623 d->windowFrameMouseMoveEvent(static_cast<QGraphicsSceneMouseEvent *>(event));-
624 event->accept();-
625 }-
626 break;-
627 case QEvent::GraphicsSceneMouseRelease:-
628 d->windowFrameMouseReleaseEvent(static_cast<QGraphicsSceneMouseEvent *>(event));-
629 break;-
630 case QEvent::GraphicsSceneHoverMove:-
631 d->windowFrameHoverMoveEvent(static_cast<QGraphicsSceneHoverEvent *>(event));-
632 break;-
633 case QEvent::GraphicsSceneHoverLeave:-
634 d->windowFrameHoverLeaveEvent(static_cast<QGraphicsSceneHoverEvent *>(event));-
635 break;-
636 default:-
637 break;-
638 }-
639 return event->isAccepted();-
640}-
641Qt::WindowFrameSection QGraphicsWidget::windowFrameSectionAt(const QPointF &pos) const-
642{-
643 const QGraphicsWidgetPrivate * const d = d_func();-
644-
645 const QRectF r = windowFrameRect();-
646 if (!r.contains(pos))-
647 return Qt::NoSection;-
648-
649 const qreal left = r.left();-
650 const qreal top = r.top();-
651 const qreal right = r.right();-
652 const qreal bottom = r.bottom();-
653 const qreal x = pos.x();-
654 const qreal y = pos.y();-
655-
656 const qreal cornerMargin = 20;-
657-
658 const qreal windowFrameWidth = d->windowFrameMargins-
659 ? d->windowFrameMargins[d->Left] : 0;-
660-
661 Qt::WindowFrameSection s = Qt::NoSection;-
662 if (x <= left + cornerMargin) {-
663 if (y <= top + windowFrameWidth || (x <= left + windowFrameWidth && y <= top + cornerMargin)) {-
664 s = Qt::TopLeftSection;-
665 } else if (y >= bottom - windowFrameWidth || (x <= left + windowFrameWidth && y >= bottom - cornerMargin)) {-
666 s = Qt::BottomLeftSection;-
667 } else if (x <= left + windowFrameWidth) {-
668 s = Qt::LeftSection;-
669 }-
670 } else if (x >= right - cornerMargin) {-
671 if (y <= top + windowFrameWidth || (x >= right - windowFrameWidth && y <= top + cornerMargin)) {-
672 s = Qt::TopRightSection;-
673 } else if (y >= bottom - windowFrameWidth || (x >= right - windowFrameWidth && y >= bottom - cornerMargin)) {-
674 s = Qt::BottomRightSection;-
675 } else if (x >= right - windowFrameWidth) {-
676 s = Qt::RightSection;-
677 }-
678 } else if (y <= top + windowFrameWidth) {-
679 s = Qt::TopSection;-
680 } else if (y >= bottom - windowFrameWidth) {-
681 s = Qt::BottomSection;-
682 }-
683 if (s == Qt::NoSection) {-
684 QRectF r1 = r;-
685 r1.setHeight(d->windowFrameMargins-
686 ? d->windowFrameMargins[d->Top] : 0);-
687 if (r1.contains(pos))-
688 s = Qt::TitleBarArea;-
689 }-
690 return s;-
691}-
692bool QGraphicsWidget::event(QEvent *event)-
693{-
694 QGraphicsWidgetPrivate * const d = d_func();-
695-
696 if (d->layout)-
697 d->layout->widgetEvent(event);-
698-
699-
700 switch (event->type()) {-
701 case QEvent::GraphicsSceneMove:-
702 moveEvent(static_cast<QGraphicsSceneMoveEvent *>(event));-
703 break;-
704 case QEvent::GraphicsSceneResize:-
705 resizeEvent(static_cast<QGraphicsSceneResizeEvent *>(event));-
706 break;-
707 case QEvent::Show:-
708 showEvent(static_cast<QShowEvent *>(event));-
709 break;-
710 case QEvent::Hide:-
711 hideEvent(static_cast<QHideEvent *>(event));-
712 break;-
713 case QEvent::Polish:-
714 polishEvent();-
715 d->polished = true;-
716 if (!d->font.isCopyOf(QApplication::font()))-
717 d->updateFont(d->font);-
718 break;-
719 case QEvent::WindowActivate:-
720 case QEvent::WindowDeactivate:-
721 update();-
722 break;-
723 case QEvent::StyleAnimationUpdate:-
724 if (isVisible()) {-
725 event->accept();-
726 update();-
727 }-
728 break;-
729-
730 case QEvent::ActivationChange:-
731 case QEvent::EnabledChange:-
732 case QEvent::FontChange:-
733 case QEvent::StyleChange:-
734 case QEvent::PaletteChange:-
735 case QEvent::ParentChange:-
736 case QEvent::ContentsRectChange:-
737 case QEvent::LayoutDirectionChange:-
738 changeEvent(event);-
739 break;-
740 case QEvent::Close:-
741 closeEvent((QCloseEvent *)event);-
742 break;-
743 case QEvent::GrabMouse:-
744 grabMouseEvent(event);-
745 break;-
746 case QEvent::UngrabMouse:-
747 ungrabMouseEvent(event);-
748 break;-
749 case QEvent::GrabKeyboard:-
750 grabKeyboardEvent(event);-
751 break;-
752 case QEvent::UngrabKeyboard:-
753 ungrabKeyboardEvent(event);-
754 break;-
755 case QEvent::GraphicsSceneMousePress:-
756 if (d->hasDecoration() && windowFrameEvent(event))-
757 return true;-
758 break;-
759 case QEvent::GraphicsSceneMouseMove:-
760 case QEvent::GraphicsSceneMouseRelease:-
761 case QEvent::GraphicsSceneMouseDoubleClick:-
762 d->ensureWindowData();-
763 if (d->hasDecoration() && d->windowData->grabbedSection != Qt::NoSection)-
764 return windowFrameEvent(event);-
765 break;-
766 case QEvent::GraphicsSceneHoverEnter:-
767 case QEvent::GraphicsSceneHoverMove:-
768 case QEvent::GraphicsSceneHoverLeave:-
769 if (d->hasDecoration()) {-
770 windowFrameEvent(event);-
771-
772-
773 if (!acceptHoverEvents())-
774 return true;-
775 }-
776 break;-
777 default:-
778 break;-
779 }-
780 return QObject::event(event);-
781}-
782void QGraphicsWidget::changeEvent(QEvent *event)-
783{-
784 QGraphicsWidgetPrivate * const d = d_func();-
785 switch (event->type()) {-
786 case QEvent::StyleChange:-
787-
788 unsetWindowFrameMargins();-
789 if (d->layout)-
790 d->layout->invalidate();-
791 case QEvent::FontChange:-
792 update();-
793 updateGeometry();-
794 break;-
795 case QEvent::PaletteChange:-
796 update();-
797 break;-
798 case QEvent::ParentChange:-
799 d->resolveFont(d->inheritedFontResolveMask);-
800 d->resolvePalette(d->inheritedPaletteResolveMask);-
801 break;-
802 default:-
803 break;-
804 }-
805}-
806void QGraphicsWidget::closeEvent(QCloseEvent *event)-
807{-
808 event->accept();-
809}-
810-
811-
812-
813-
814void QGraphicsWidget::focusInEvent(QFocusEvent *event)-
815{-
816 (void)event;;-
817 if (focusPolicy() != Qt::NoFocus)-
818 update();-
819}-
820bool QGraphicsWidget::focusNextPrevChild(bool next)-
821{-
822 QGraphicsWidgetPrivate * const d = d_func();-
823-
824 QGraphicsWidget *parent = 0;-
825 if (!isWindow() && (parent = parentWidget()))-
826 return parent->focusNextPrevChild(next);-
827 if (!d->scene)-
828 return false;-
829 if (d->scene->focusNextPrevChild(next))-
830 return true;-
831 if (isWindow()) {-
832 setFocus(next ? Qt::TabFocusReason : Qt::BacktabFocusReason);-
833 if (hasFocus())-
834 return true;-
835 }-
836 return false;-
837}-
838-
839-
840-
841-
842void QGraphicsWidget::focusOutEvent(QFocusEvent *event)-
843{-
844 (void)event;;-
845 if (focusPolicy() != Qt::NoFocus)-
846 update();-
847}-
848void QGraphicsWidget::hideEvent(QHideEvent *event)-
849{-
850-
851-
852 (void)event;;-
853}-
854void QGraphicsWidget::moveEvent(QGraphicsSceneMoveEvent *event)-
855{-
856-
857 (void)event;;-
858}-
859void QGraphicsWidget::polishEvent()-
860{-
861}-
862void QGraphicsWidget::resizeEvent(QGraphicsSceneResizeEvent *event)-
863{-
864 (void)event;;-
865}-
866void QGraphicsWidget::showEvent(QShowEvent *event)-
867{-
868 (void)event;;-
869}-
870-
871-
872-
873-
874void QGraphicsWidget::hoverMoveEvent(QGraphicsSceneHoverEvent *event)-
875{-
876 (void)event;;-
877}-
878-
879-
880-
881-
882void QGraphicsWidget::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)-
883{-
884 QGraphicsObject::hoverLeaveEvent(event);-
885}-
886-
887-
888-
889-
890-
891-
892-
893void QGraphicsWidget::grabMouseEvent(QEvent *event)-
894{-
895 (void)event;;-
896}-
897-
898-
899-
900-
901-
902-
903-
904void QGraphicsWidget::ungrabMouseEvent(QEvent *event)-
905{-
906 (void)event;;-
907}-
908-
909-
910-
911-
912-
913-
914-
915void QGraphicsWidget::grabKeyboardEvent(QEvent *event)-
916{-
917 (void)event;;-
918}-
919-
920-
921-
922-
923-
924-
925-
926void QGraphicsWidget::ungrabKeyboardEvent(QEvent *event)-
927{-
928 (void)event;;-
929}-
930-
931-
932-
933-
934-
935-
936Qt::WindowType QGraphicsWidget::windowType() const-
937{-
938 return Qt::WindowType(int(windowFlags()) & Qt::WindowType_Mask);-
939}-
940Qt::WindowFlags QGraphicsWidget::windowFlags() const-
941{-
942 const QGraphicsWidgetPrivate * const d = d_func();-
943 return d->windowFlags;-
944}-
945void QGraphicsWidget::setWindowFlags(Qt::WindowFlags wFlags)-
946{-
947 QGraphicsWidgetPrivate * const d = d_func();-
948 if (d->windowFlags == wFlags)-
949 return;-
950 bool wasPopup = (d->windowFlags & Qt::WindowType_Mask) == Qt::Popup;-
951-
952 d->adjustWindowFlags(&wFlags);-
953 d->windowFlags = wFlags;-
954 if (!d->setWindowFrameMargins)-
955 unsetWindowFrameMargins();-
956-
957 setFlag(ItemIsPanel, d->windowFlags & Qt::Window);-
958-
959 bool isPopup = (d->windowFlags & Qt::WindowType_Mask) == Qt::Popup;-
960 if (d->scene && isVisible() && wasPopup != isPopup) {-
961-
962 if (!isPopup)-
963 d->scene->d_func()->removePopup(this);-
964 else-
965 d->scene->d_func()->addPopup(this);-
966 }-
967-
968 if (d->scene && d->scene->d_func()->allItemsIgnoreHoverEvents && d->hasDecoration()) {-
969 d->scene->d_func()->allItemsIgnoreHoverEvents = false;-
970 d->scene->d_func()->enableMouseTrackingOnViews();-
971 }-
972}-
973bool QGraphicsWidget::isActiveWindow() const-
974{-
975 return isActive();-
976}-
977void QGraphicsWidget::setWindowTitle(const QString &title)-
978{-
979 QGraphicsWidgetPrivate * const d = d_func();-
980 d->ensureWindowData();-
981 d->windowData->windowTitle = title;-
982}-
983QString QGraphicsWidget::windowTitle() const-
984{-
985 const QGraphicsWidgetPrivate * const d = d_func();-
986 return d->windowData ? d->windowData->windowTitle : QString();-
987}-
988Qt::FocusPolicy QGraphicsWidget::focusPolicy() const-
989{-
990 const QGraphicsWidgetPrivate * const d = d_func();-
991 return d->focusPolicy;-
992}-
993void QGraphicsWidget::setFocusPolicy(Qt::FocusPolicy policy)-
994{-
995 QGraphicsWidgetPrivate * const d = d_func();-
996 if (d->focusPolicy == policy)-
997 return;-
998 d->focusPolicy = policy;-
999 if (hasFocus() && policy == Qt::NoFocus)-
1000 clearFocus();-
1001 setFlag(ItemIsFocusable, policy != Qt::NoFocus);-
1002}-
1003QGraphicsWidget *QGraphicsWidget::focusWidget() const-
1004{-
1005 const QGraphicsWidgetPrivate * const d = d_func();-
1006 if (d->subFocusItem && d->subFocusItem->d_ptr->isWidget)-
1007 return static_cast<QGraphicsWidget *>(d->subFocusItem);-
1008 return 0;-
1009}-
1010int QGraphicsWidget::grabShortcut(const QKeySequence &sequence, Qt::ShortcutContext context)-
1011{-
1012 ((!((static_cast<QApplication *>(QCoreApplication::instance())))) ? qt_assert("qApp",__FILE__,19101917) : qt_noop());-
1013 if (sequence.isEmpty())-
1014 return 0;-
1015-
1016 return (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.addShortcut(this, sequence, context, qWidgetShortcutContextMatcher);-
1017}-
1018void QGraphicsWidget::releaseShortcut(int id)-
1019{-
1020 ((!((static_cast<QApplication *>(QCoreApplication::instance())))) ? qt_assert("qApp",__FILE__,19361943) : qt_noop());-
1021 if (id)-
1022 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(id, this, 0);-
1023}-
1024void QGraphicsWidget::setShortcutEnabled(int id, bool enabled)-
1025{-
1026 ((!((static_cast<QApplication *>(QCoreApplication::instance())))) ? qt_assert("qApp",__FILE__,19571964) : qt_noop());-
1027 if (id)-
1028 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.setShortcutEnabled(enabled, id, this, 0);-
1029}-
1030void QGraphicsWidget::setShortcutAutoRepeat(int id, bool enabled)-
1031{-
1032 ((!((static_cast<QApplication *>(QCoreApplication::instance())))) ? qt_assert("qApp",__FILE__,19721979) : qt_noop());-
1033 if (id)-
1034 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.setShortcutAutoRepeat(enabled, id, this, 0);-
1035}-
1036void QGraphicsWidget::addAction(QAction *action)-
1037{-
1038 insertAction(0, action);-
1039}-
1040void QGraphicsWidget::addActions(QList<QAction *> actions)-
1041-
1042{-
1043 for (int i = 0; i < actions.count(); ++i)-
1044 insertAction(0, actions.at(i));-
1045}-
1046void QGraphicsWidget::insertAction(QAction *before, QAction *action)-
1047{-
1048 if (!action) {-
1049 QMessageLogger(__FILE__, 20302037, __PRETTY_FUNCTION__).warning("QWidget::insertAction: Attempt to insert null action");-
1050 return;-
1051 }-
1052-
1053 QGraphicsWidgetPrivate * const d = d_func();-
1054 int index = d->actions.indexOf(action);-
1055 if (index != -1)-
1056 d->actions.removeAt(index);-
1057-
1058 int pos = d->actions.indexOf(before);-
1059 if (pos < 0) {-
1060 before = 0;-
1061 pos = d->actions.size();-
1062 }-
1063 d->actions.insert(pos, action);-
1064-
1065 if (index == -1) {-
1066 QActionPrivate *apriv = action->d_func();-
1067 apriv->graphicsWidgets.append(this);-
1068 }-
1069-
1070 QActionEvent e(QEvent::ActionAdded, action, before);-
1071 QApplication::sendEvent(this, &e);-
1072}-
1073void QGraphicsWidget::insertActions(QAction *before, QList<QAction *> actions)-
1074-
1075{-
1076 for (int i = 0; i < actions.count()
i < actions.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
1077 insertAction(before, actions.at(i));
never executed: insertAction(before, actions.at(i));
0
1078}
never executed: end of block
0
1079void QGraphicsWidget::removeAction(QAction *action)-
1080{-
1081 if (!action)-
1082 return;-
1083-
1084 QGraphicsWidgetPrivate * const d = d_func();-
1085-
1086 QActionPrivate *apriv = action->d_func();-
1087 apriv->graphicsWidgets.removeAll(this);-
1088-
1089 if (d->actions.removeAll(action)) {-
1090 QActionEvent e(QEvent::ActionRemoved, action);-
1091 QApplication::sendEvent(this, &e);-
1092 }-
1093}-
1094QList<QAction *> QGraphicsWidget::actions() const-
1095{-
1096 const QGraphicsWidgetPrivate * const d = d_func();-
1097 return d->actions;-
1098}-
1099void QGraphicsWidget::setTabOrder(QGraphicsWidget *first, QGraphicsWidget *second)-
1100{-
1101 if (!first && !second) {-
1102 QMessageLogger(__FILE__, 21372148, __PRETTY_FUNCTION__).warning("QGraphicsWidget::setTabOrder(0, 0) is undefined");-
1103 return;-
1104 }-
1105 if ((first && second) && first->scene() != second->scene()) {-
1106 QMessageLogger(__FILE__, 21412152, __PRETTY_FUNCTION__).warning("QGraphicsWidget::setTabOrder: scenes %p and %p are different",-
1107 first->scene(), second->scene());-
1108 return;-
1109 }-
1110 QGraphicsScene *scene = first ? first->scene() : second->scene();-
1111 if (!scene && (!first || !second)) {-
1112 QMessageLogger(__FILE__, 21472158, __PRETTY_FUNCTION__).warning("QGraphicsWidget::setTabOrder: assigning tab order from/to the"-
1113 " scene requires the item to be in a scene.");-
1114 return;-
1115 }-
1116-
1117-
1118-
1119-
1120 QGraphicsScenePrivate *sceneD = scene->d_func();-
1121 if (!first) {-
1122 sceneD->tabFocusFirst = second;-
1123 return;-
1124 }-
1125 if (!second) {-
1126 sceneD->tabFocusFirst = first->d_func()->focusNext;-
1127 return;-
1128 }-
1129-
1130-
1131 QGraphicsWidget *firstFocusNext = first->d_func()->focusNext;-
1132 if (firstFocusNext == second) {-
1133-
1134 return;-
1135 }-
1136-
1137-
1138 QGraphicsWidget *secondFocusPrev = second->d_func()->focusPrev;-
1139 QGraphicsWidget *secondFocusNext = second->d_func()->focusNext;-
1140 firstFocusNext->d_func()->focusPrev = second;-
1141 first->d_func()->focusNext = second;-
1142 second->d_func()->focusNext = firstFocusNext;-
1143 second->d_func()->focusPrev = first;-
1144 secondFocusPrev->d_func()->focusNext = secondFocusNext;-
1145 secondFocusNext->d_func()->focusPrev = secondFocusPrev;-
1146-
1147 ((!(first->d_func()->focusNext->d_func()->focusPrev == first)) ? qt_assert("first->d_func()->focusNext->d_func()->focusPrev == first",__FILE__,21822193) : qt_noop());-
1148 ((!(first->d_func()->focusPrev->d_func()->focusNext == first)) ? qt_assert("first->d_func()->focusPrev->d_func()->focusNext == first",__FILE__,21832194) : qt_noop());-
1149-
1150 ((!(second->d_func()->focusNext->d_func()->focusPrev == second)) ? qt_assert("second->d_func()->focusNext->d_func()->focusPrev == second",__FILE__,21852196) : qt_noop());-
1151 ((!(second->d_func()->focusPrev->d_func()->focusNext == second)) ? qt_assert("second->d_func()->focusPrev->d_func()->focusNext == second",__FILE__,21862197) : qt_noop());-
1152-
1153}-
1154void QGraphicsWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)-
1155{-
1156 QGraphicsWidgetPrivate * const d = d_func();-
1157-
1158-
1159-
1160 d->setAttribute(attribute, on);-
1161}-
1162-
1163-
1164-
1165-
1166-
1167-
1168-
1169bool QGraphicsWidget::testAttribute(Qt::WidgetAttribute attribute) const-
1170{-
1171 const QGraphicsWidgetPrivate * const d = d_func();-
1172 return d->testAttribute(attribute);-
1173}-
1174-
1175-
1176-
1177-
1178int QGraphicsWidget::type() const-
1179{-
1180 return Type;-
1181}-
1182-
1183-
1184-
1185-
1186void QGraphicsWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)-
1187{-
1188 (void)painter;;-
1189 (void)option;;-
1190 (void)widget;;-
1191}-
1192void QGraphicsWidget::paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option,-
1193 QWidget *widget)-
1194{-
1195 const bool fillBackground = !testAttribute(Qt::WA_OpaquePaintEvent)
!testAttribute...quePaintEvent)Description
TRUEnever evaluated
FALSEnever evaluated
0
1196 && !testAttribute(Qt::WA_NoSystemBackground)
!testAttribute...temBackground)Description
TRUEnever evaluated
FALSEnever evaluated
;
0
1197 QGraphicsProxyWidget *proxy = qobject_cast<QGraphicsProxyWidget *>(this);-
1198 const bool embeddedWidgetFillsOwnBackground = proxy
proxyDescription
TRUEnever evaluated
FALSEnever evaluated
&& proxy->widget()
proxy->widget()Description
TRUEnever evaluated
FALSEnever evaluated
;
0
1199-
1200 if (rect().contains(option->exposedRect)
rect().contain...->exposedRect)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1201 if (fillBackground
fillBackgroundDescription
TRUEnever evaluated
FALSEnever evaluated
&& !embeddedWidgetFillsOwnBackground
!embeddedWidge...sOwnBackgroundDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1202 painter->fillRect(option->exposedRect, palette().window());
never executed: painter->fillRect(option->exposedRect, palette().window());
0
1203 return;
never executed: return;
0
1204 }-
1205-
1206 QGraphicsWidgetPrivate * const d = d_func();-
1207-
1208 QRect windowFrameRect = QRect(QPoint(), windowFrameGeometry().size().toSize());-
1209 QStyleOptionTitleBar bar;-
1210 bar.QStyleOption::operator=(*option);-
1211 d->initStyleOptionTitleBar(&bar);-
1212 d->ensureWindowData();-
1213 if (d->windowData->buttonMouseOver)bar.state|= QStyle::State_MouseOver;-
else
bar.state &= ~setFlag(QStyle::State_MouseOver;
if (, d->windowData->buttonSunken)buttonMouseOver);
1214 bar.state|= QStyle::State_Sunken;-
else
bar.state &= ~setFlag(QStyle::State_Sunken;, d->windowData->buttonSunken);
1215 bar.rect = windowFrameRect;-
1216-
1217-
1218 const QPointF styleOrigin = this->windowFrameRect().topLeft();-
1219 painter->translate(styleOrigin);-
1220 QStyleHintReturnMask mask;-
1221 bool setMask = style()->styleHint(QStyle::SH_WindowFrame_Mask, &bar, widget, &mask)
style()->style...widget, &mask)Description
TRUEnever evaluated
FALSEnever evaluated
&& !mask.region.isEmpty()
!mask.region.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
;
0
1222 bool hasBorder = !style()->styleHint(QStyle::SH_TitleBar_NoBorder, &bar, widget);-
1223 int frameWidth = style()->pixelMetric(QStyle::PM_MDIFrameWidth, &bar, widget);-
1224 if (setMask
setMaskDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1225 painter->save();-
1226 painter->setClipRegion(mask.region, Qt::IntersectClip);-
1227 }
never executed: end of block
0
1228 if (fillBackground
fillBackgroundDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1229 if (embeddedWidgetFillsOwnBackground
embeddedWidget...sOwnBackgroundDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1230-
1231 QPainterPath windowFrameBackground;-
1232 windowFrameBackground.addRect(windowFrameRect);-
1233-
1234-
1235 windowFrameBackground.addRect(rect().translated(-styleOrigin).adjusted(0.5, 0.5, -0.5, -0.5));-
1236 painter->fillPath(windowFrameBackground, palette().window());-
1237 }
never executed: end of block
else {
0
1238 painter->fillRect(windowFrameRect, palette().window());-
1239 }
never executed: end of block
0
1240 }-
1241-
1242-
1243 int height = (int)d->titleBarHeight(bar);-
1244 bar.rect.setHeight(height);-
1245 if (hasBorder
hasBorderDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1246 bar.rect.adjust(frameWidth, frameWidth, -frameWidth, 0);
never executed: bar.rect.adjust(frameWidth, frameWidth, -frameWidth, 0);
0
1247-
1248 painter->save();-
1249 painter->setFont(QApplication::font("QMdiSubWindowTitleBar"));-
1250 style()->drawComplexControl(QStyle::CC_TitleBar, &bar, painter, widget);-
1251 painter->restore();-
1252 if (setMask
setMaskDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1253 painter->restore();
never executed: painter->restore();
0
1254-
1255 QStyleOptionFrame frameOptions;-
1256 frameOptions.QStyleOption::operator=(*option);-
1257 initStyleOption(&frameOptions);-
1258 if (!hasBorder
!hasBorderDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1259 painter->setClipRect(windowFrameRect.adjusted(0, +height, 0, 0), Qt::IntersectClip);
never executed: painter->setClipRect(windowFrameRect.adjusted(0, +height, 0, 0), Qt::IntersectClip);
0
1260 if (hasFocus()) {frameOptions.state|= QStyle::State_HasFocus;-
} else {
frameOptions.state &= ~setFlag(QStyle::State_HasFocus;
}, hasFocus());
1261 bool isActive = isActiveWindow();-
1262 if (isActive) {frameOptions.state|= QStyle::State_Active;-
} else {
frameOptions.state &= ~setFlag(QStyle::State_Active;
}, isActive);
1263-
1264 frameOptions.palette.setCurrentColorGroup(isActive ? QPalette::Active : QPalette::Normal);-
1265 frameOptions.rect = windowFrameRect;-
1266 frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, widget);-
1267 frameOptions.midLineWidth = 1;-
1268 style()->drawPrimitive(QStyle::PE_FrameWindow, &frameOptions, painter, widget);-
1269-
1270-
1271-
1272-
1273-
1274}
never executed: end of block
0
1275-
1276-
1277-
1278-
1279QRectF QGraphicsWidget::boundingRect() const-
1280{-
1281 return windowFrameRect();-
1282}-
1283-
1284-
1285-
1286-
1287QPainterPath QGraphicsWidget::shape() const-
1288{-
1289 QPainterPath path;-
1290 path.addRect(rect());-
1291 return path;-
1292}-
1293bool QGraphicsWidget::close()-
1294{-
1295 QCloseEvent closeEvent;-
1296 QApplication::sendEvent(this, &closeEvent);-
1297 if (!closeEvent.isAccepted()) {-
1298 return false;-
1299 }-
1300-
1301 if (isVisible()) {-
1302 hide();-
1303 }-
1304 if (testAttribute(Qt::WA_DeleteOnClose)) {-
1305 deleteLater();-
1306 }-
1307 return true;-
1308}-
1309-
1310-
Switch to Source codePreprocessed file

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