qgraphicslayout_p.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/graphicsview/qgraphicslayout_p.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13void QGraphicsLayoutPrivate::reparentChildItems(QGraphicsItem *newParent)-
14{-
15 QGraphicsLayout * const q = q_func();-
16 int n = q->count();-
17-
18 for (int i = 0; i < n
i < nDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
19 QGraphicsLayoutItem *layoutChild = q->itemAt(i);-
20 if (!layoutChild
!layoutChildDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
21-
22 continue;
never executed: continue;
0
23 }-
24 if (layoutChild->isLayout()
layoutChild->isLayout()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
25 QGraphicsLayout *l = static_cast<QGraphicsLayout*>(layoutChild);-
26 l->d_func()->reparentChildItems(newParent);-
27 }
never executed: end of block
else if (QGraphicsItem *itemChild = layoutChild->graphicsItem()
QGraphicsItem ...graphicsItem()Description
TRUEnever evaluated
FALSEnever evaluated
){
0
28 QGraphicsItem *childParent = itemChild->parentItem();-
29-
30 if (childParent
childParentDescription
TRUEnever evaluated
FALSEnever evaluated
&& childParent != newParent
childParent != newParentDescription
TRUEnever evaluated
FALSEnever evaluated
&& itemChild->isWidget()
itemChild->isWidget()Description
TRUEnever evaluated
FALSEnever evaluated
&& qt_graphicsLayoutDebug()
qt_graphicsLayoutDebug()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
31 QGraphicsWidget *w = static_cast<QGraphicsWidget*>(layoutChild);-
32 QMessageLogger(__FILE__, 75, __PRETTY_FUNCTION__).warning("QGraphicsLayout::addChildLayout: widget %s \"%s\" in wrong parent; moved to correct parent",-
33 w->metaObject()->className(), w->objectName().toLocal8Bit().constData());-
34 }
never executed: end of block
0
35-
36 if (childParent != newParent
childParent != newParentDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
37 itemChild->setParentItem(newParent);
never executed: itemChild->setParentItem(newParent);
0
38 }
never executed: end of block
0
39 }
never executed: end of block
0
40}
never executed: end of block
0
41-
42void QGraphicsLayoutPrivate::getMargin(qreal *result, qreal userMargin, QStyle::PixelMetric pm) const-
43{-
44 if (!result
!resultDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
45 return;
never executed: return;
0
46 const QGraphicsLayout * const q = q_func();-
47-
48 QGraphicsLayoutItem *parent = q->parentLayoutItem();-
49 if (userMargin >= 0.0
userMargin >= 0.0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
50 *result = userMargin;-
51 }
never executed: end of block
else if (!parent
!parentDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
52 *result = 0.0;-
53 }
never executed: end of block
else if (parent->isLayout()
parent->isLayout()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
54 *result = 0.0;-
55 }
never executed: end of block
else {
0
56 *result = 0.0;-
57 if (QGraphicsItem *layoutParentItem = parentItem()
QGraphicsItem ...= parentItem()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
58 if (layoutParentItem->isWidget()
layoutParentItem->isWidget()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
59 *
never executed: *result = (qreal)static_cast<QGraphicsWidget*>(layoutParentItem)->style()->pixelMetric(pm, 0);
result = (qreal)static_cast<QGraphicsWidget*>(layoutParentItem)->style()->pixelMetric(pm, 0);
never executed: *result = (qreal)static_cast<QGraphicsWidget*>(layoutParentItem)->style()->pixelMetric(pm, 0);
0
60 }
never executed: end of block
0
61 }
never executed: end of block
0
62}-
63-
64Qt::LayoutDirection QGraphicsLayoutPrivate::visualDirection() const-
65{-
66 if (QGraphicsItem *maybeWidget = parentItem()
QGraphicsItem ...= parentItem()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
67 if (maybeWidget->isWidget()
maybeWidget->isWidget()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
68 return
never executed: return static_cast<QGraphicsWidget*>(maybeWidget)->layoutDirection();
static_cast<QGraphicsWidget*>(maybeWidget)->layoutDirection();
never executed: return static_cast<QGraphicsWidget*>(maybeWidget)->layoutDirection();
0
69 }
never executed: end of block
0
70 return
never executed: return QApplication::layoutDirection();
QApplication::layoutDirection();
never executed: return QApplication::layoutDirection();
0
71}-
72-
73static bool removeLayoutItemFromLayout(QGraphicsLayout *lay, QGraphicsLayoutItem *layoutItem)-
74{-
75 if (!lay
!layDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
76 return
never executed: return false;
false;
never executed: return false;
0
77-
78 for (int i = lay->count() - 1; i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --i) {
0
79 QGraphicsLayoutItem *child = lay->itemAt(i);-
80 if (child
childDescription
TRUEnever evaluated
FALSEnever evaluated
&& child->isLayout()
child->isLayout()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
81 if (removeLayoutItemFromLayout(static_cast<QGraphicsLayout*>(child), layoutItem)
removeLayoutIt...), layoutItem)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
82 return
never executed: return true;
true;
never executed: return true;
0
83 }
never executed: end of block
else if (child == layoutItem
child == layoutItemDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
84 lay->removeAt(i);-
85 return
never executed: return true;
true;
never executed: return true;
0
86 }-
87 }
never executed: end of block
0
88 return
never executed: return false;
false;
never executed: return false;
0
89}-
90void QGraphicsLayoutPrivate::addChildLayoutItem(QGraphicsLayoutItem *layoutItem)-
91{-
92 QGraphicsLayout * const q = q_func();-
93 if (QGraphicsLayoutItem *maybeLayout = layoutItem->parentLayoutItem()
QGraphicsLayou...ntLayoutItem()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
94 if (maybeLayout->isLayout()
maybeLayout->isLayout()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
95 removeLayoutItemFromLayout(static_cast<QGraphicsLayout*>(maybeLayout), layoutItem);
never executed: removeLayoutItemFromLayout(static_cast<QGraphicsLayout*>(maybeLayout), layoutItem);
0
96 }
never executed: end of block
0
97 layoutItem->setParentLayoutItem(q);-
98 if (layoutItem->isLayout()
layoutItem->isLayout()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
99 if (QGraphicsItem *parItem = parentItem()
QGraphicsItem ...= parentItem()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
100 static_cast<QGraphicsLayout*>(layoutItem)->d_func()->reparentChildItems(parItem);-
101 }
never executed: end of block
0
102 }
never executed: end of block
else {
0
103 if (QGraphicsItem *item = layoutItem->graphicsItem()
QGraphicsItem ...graphicsItem()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
104 QGraphicsItem *newParent = parentItem();-
105 QGraphicsItem *oldParent = item->parentItem();-
106 if (oldParent == newParent
oldParent == newParentDescription
TRUEnever evaluated
FALSEnever evaluated
|| !newParent
!newParentDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
107 return;
never executed: return;
0
108-
109-
110 if (oldParent
oldParentDescription
TRUEnever evaluated
FALSEnever evaluated
&& item->isWidget()
item->isWidget()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
111 QGraphicsWidget *w = static_cast<QGraphicsWidget*>(item);-
112 QMessageLogger(__FILE__, 167, __PRETTY_FUNCTION__).warning("QGraphicsLayout::addChildLayoutItem: %s \"%s\" in wrong parent; moved to correct parent",-
113 w->metaObject()->className(), w->objectName().toLocal8Bit().constData());-
114 }
never executed: end of block
0
115-
116-
117 item->setParentItem(newParent);-
118 }
never executed: end of block
0
119 }
never executed: end of block
0
120}-
121-
122void QGraphicsLayoutPrivate::activateRecursive(QGraphicsLayoutItem *item)-
123{-
124 if (item->isLayout()
item->isLayout()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
125 QGraphicsLayout *layout = static_cast<QGraphicsLayout *>(item);-
126 if (layout->d_func()->activated
layout->d_func()->activatedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
127 if (QGraphicsLayout::instantInvalidatePropagation()
QGraphicsLayou...ePropagation()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
128 return;
never executed: return;
0
129 } else {-
130 layout->invalidate();-
131 }
never executed: end of block
0
132 }-
133-
134 for (int i = layout->count() - 1; i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --i) {
0
135 QGraphicsLayoutItem *childItem = layout->itemAt(i);-
136 if (childItem
childItemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
137 activateRecursive(childItem);
never executed: activateRecursive(childItem);
0
138 }
never executed: end of block
0
139 layout->d_func()->activated = true;-
140 }
never executed: end of block
0
141}
never executed: end of block
0
142-
143-
144-
Switch to Source codePreprocessed file

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